freeCodeCamp/curriculum/challenges/chinese/01-responsive-web-design/basic-html-and-html5/make-dead-links-using-the-h...

1.7 KiB

id title challengeType videoUrl localeTitle
bad87fee1348bd9aedf08817 Make Dead Links Using the Hash Symbol 0 使用哈希符号制作死链接

Description

有时你想添加a元素到你的网站,你知道他们会链接之前。当您使用JavaScript更改链接的行为时,这也很方便,我们将在稍后了解。

Instructions

href属性的当前值是指向“http://freecatphotoapp.com”的链接。将href属性值替换为# (也称为哈希符号)以创建死链接。例如: href="#"

Tests

tests:
  - text: 您<code>a</code>元素应该是一个死链接, <code>href</code>属性的值设置为“#”。
    testString: 'assert($("a").attr("href") === "#", "Your <code>a</code> element should be a dead link with the value of the <code>href</code> attribute set to "#".");'

Challenge Seed

<h2>CatPhotoApp</h2>
<main>
  <p>Click here to view more <a href="http://freecatphotoapp.com" target="_blank">cat photos</a>.</p>

  <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">

  <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
  <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
</main>

Solution

// solution required