我已经在页面上创建了书签,以从导航菜单跳转到页面上的其他位置。这是使用id =“ name”完成的;在导航菜单中的位置。测试代码时,这些书签/链接不起作用。他们要么不执行任何操作,要么显示一条错误消息,即找不到该页面。
链接到一段代码:https://www.w3schools.com/code/tryit.asp?filename=GCKPLQW16JZP
[发现有些东西说在锚标记中放置一个额外的'#'可以解决问题。这什么也没做。例如-<a href="##name">
。
关于如何解决问题的任何建议,以便书签实际上可以用作链接?
您需要在每个<a name='youranchor'>
前面使用<h3>
并删除baseref标签以使其起作用。
检查https://www.w3schools.com/tags/att_a_name.asp
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Shanghaiers' TV & Radio - Television</title>
<meta charset="UTF-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style-tvradio.css">
<link href="https://fonts.googleapis.com/css?family=Goudy+Bookletter+1911" rel="stylesheet">
</head>
<body>
<h3>Shanghaiers' Television</h3>
<section>
<div>
<ul>
<li><a href="tv/allvideos.html">All Videos</a></li>
<li><a href="#concert">Concerts</a></li>
<li><a href="#nn">Native Nations</a></li>
<li><a href="#human">Human Trafficking</a></li>
<li><a href="#sacred">Sacred Lands</a></li>
<li><a href="#story">Story Telling</a></li>
<li><a href="#bigfoot">Big Foot & Sasquatch</a></li>
<li><a href="#interview">Interviews</a></li>
<li><a href="#psa">Public Service Announcements</a></li>
<li><a href="#shanghai">Shanghai Tunnels</a></li>
</ul>
</div>
</section>
<a name="concert">
<h3 id="concert">Concerts</h3>
<p>en Taiko</p>
<p>Maiah Wynee</p>
<h3 id="nn">Native Nations</h3>
<p>Native American Music</p>
<p>Occupation of Malheur Wildlife Refuge</p>
<p>NAYA Canoe Family</p>
<p>Grand Ronde Tribe Disenrollment & Chinook Language</p>
<h3 id="human">Human Trafficking</h3>
<p>More info here...</p>
<h3 id="sacred">Sacred Lands</h3>
<p>More info here...</p>
<h3 id="story">Story Telling</h3>
<p>More info here...</p>
</body>
</html>