2015-03-25 104 views
1

我想引导访问者到另一个html文件中的特定div, 这就是它在同一个html:<a href="#goTo"></a>中的情况,但如果div在另一个html中,它不起作用。例如<a href="../index.html #goTo">This link should go to the div goTo in the index file </a>链接到另一个html文件中的另一个div

+1

的index.html#GOTO做这项工作锚?没有空间。 – btevfik 2015-03-25 12:15:37

回答

0

在您的链接删除空格:

<a href="../index.html#goTo">This link should go to the div goTo in the index file</a> 
0

尝试在文件名后直接写锚,不留空格

<a href="../index.html#goTo">This link should go to the div goTo in the index file </a> 

如果不工作,检查如果锚点真的名为“goTo”。

+0

它的工作,谢谢 – Azertit 2015-03-25 12:19:24

0

你正在使用的东西叫做anchor

例子:

<a href="#goTo">Go there</a> 
[more html] 
<h2 id="goTo">My GoTo Header</h2> 

您也可以ADRESS在其他网站例如为:

<a href="otherSite.html#goTo">Go there</a> 
+0

是的,它现在的作品,谢谢 – Azertit 2015-03-25 12:19:36