1.1 KiB
1.1 KiB
id, title, challengeType, videoUrl, forumTopicId
id | title | challengeType | videoUrl | forumTopicId |
---|---|---|---|---|
bad87fee1348bd9aedf08816 | 用 a 实现网页间的跳转 | 0 | https://scrimba.com/p/pVMPUv/c8EkncB | 18226 |
--description--
你可以用 a
(Anchor,简写 a)来实现网页间的跳转。
a
需要一个href
属性指向目的地,它还需要有 a
文本,例如:
<a href="https://freecodecamp.org">传送至</a>
然后你的浏览器会显示一个可以点击的文本,点击该文本就会跳转到https://freecodecamp.org
。
--instructions--
创建一个 a
,它的href
属性为https://freecatphotoapp.com
,它的文本为cat photos
。
--hints--
a
元素的 a
文本应为:cat photos
。
assert(/cat photos/gi.test($('a').text()));
a
元素的href
属性应为:"http://freecatphotoapp<wbr>.com
"。
assert(/http:\/\/(www\.)?freecatphotoapp\.com/gi.test($('a').attr('href')));
确保a
元素有结束标记。
assert(
code.match(/<\/a>/g) &&
code.match(/<\/a>/g).length === code.match(/<a/g).length
);