在 JSP 中跳转到锚点
当跳转到 JSP 上的锚点时,HTML 锚点不起作用。例如,类似的
<a href="#name">Link</a>
...
<div id="name"></div>
失败是因为服务器实际上查找名为“filename.jps#name”的文件并返回错误。有什么解决方法吗?
When jumping to anchors on a JSP, HTML anchors do not work. Eg, something like
<a href="#name">Link</a>
...
<div id="name"></div>
fails because the server actually looks for a file named "filename.jps#name" and returns an error. Is there any workaround for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您所描述的称为 片段标识符 和目标可以是命名锚点或已识别元素,例如
此演示中演示的命名锚点变体
另请注意HTML5 规范 已弃用
name<
a
元素的 /code> 属性已被删除,因此id
将是 导航到片段标识符。What you describe is called a fragment identifier and the target can be a named anchor or an identified element, for example
with the named anchor variation demonstrated in this demo
Please also note that the HTML5 specification has deprecated the
name
attribute fora
elements has been dropped, so anid
would be the only HTML5 valid way to navigate to a fragment identifier.我认为您已在文档中设置了
标记。所有标识符链接也都与其相关。如果这是真的,那么您需要将标识符链接从 更改为另请
参阅:
I think that you've set a
<base>
tag in your document. All identifier links are also relative to it. If this is true, then you need to change your identifier links fromto
See also: