简体   繁体   English

锚元素在html中不起作用

[英]Anchor element not working in html

I have to complete a project that I havent been working on for ages ;-) Since then we changed from using firefox to chrome. 我必须完成一个我多年没有从事的项目;-)从那以后,我们从使用Firefox更改为使用chrome。

Now. 现在。 I have a table and each table row has an own anchor that allows me to jump to a specific row. 我有一个表,每个表行都有一个自己的锚,可让我跳到特定行。 This code used to work, but it seems something has changed. 这段代码曾经可以工作,但是似乎有些变化。

<a name="row-36"></a><tr onclick="document.location =  ....

I also tried 我也试过

<div id="row-36"></div><tr onclick="document.location = 

but when I call that anchor from the link the page always jumps to the middle 但是当我从链接中调用该锚点时,页面总是跳到中间

http://server/index.php#row-36

Any Idea? 任何想法? Does chrome treat those anchors differently? 铬会不同地对待那些锚吗?

Neither an <a> nor a <div> can be a sibling element of a <tr> . <a><div>都不能成为<tr>的同级元素。

If you want to link to a <tr> , then link to it . 如果要链接到<tr> ,请链接到 Give the <tr> an id . <tr>一个id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM