1.1 KiB
Raw Blame History

id, title, challengeType, videoUrl, forumTopicId
id title challengeType videoUrl forumTopicId
bad87fee1348bd9aedf08816 用 a 实现网页间的跳转 0 https://scrimba.com/p/pVMPUv/c8EkncB 18226

--description--

你可以用 aAnchor简写 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&#58;//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
);

--solutions--