如何编写像 <a href="#id"> 这样的链接,它链接到 PHP 中的同一页面?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15535699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to write a link like <a href="#id"> which link to the same page in PHP?
提问by user1888625
like in HTML, I could write <a href="#id">which could link to the place where I make a <a id="id">. but it seems that it does not work in PHP. How to do that?
就像在 HTML 中一样,我可以编写<a href="#id">可以链接到我制作<a id="id">. 但它似乎在 PHP 中不起作用。怎么做?
the original code is from bootstrap http://twitter.github.com/bootstrap/components.html#navs
原始代码来自 bootstrap http://twitter.github.com/bootstrap/components.html#navs
<div class='tabbable'>
<ul class='nav nav-tabs'>
<li class='active'><a href='#tab1' data-toggle='tab'>Drinks</a></li>
<li><a href='#tab2' data-toggle='tab'>Bread</a></li>
</ul>
<div class='tab-content'>
<div class='tab-pane active' id='tab1'><p>some</p>
</div>
<div class='tab-pane' id='tab2'><p>many</p>
</div>
</div>
but just when I turned to PHP, the tab link does not work
但就在我转向 PHP 时,选项卡链接不起作用
回答by mstfdrmz
Edit:
编辑:
Are you trying to do sth like this? See: http://twitter.github.com/bootstrap/javascript.html#tabs
你想这样做吗?请参阅:http: //twitter.github.com/bootstrap/javascript.html#tabs
See the working example: http://jsfiddle.net/U6aKT/
请参阅工作示例:http: //jsfiddle.net/U6aKT/
<a href="#id">go to id</a>
<div style="margin-top:2000px;"></div>
<a id="id">id</a>
回答by Julio Popócatl
try this
尝试这个
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<a href="#name">click me</a>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<div name="name" id="name">here</div>
</body>
</html>

