转到#div框JavaScript [英] Go to #div box JavaScript

查看:62
本文介绍了转到#div框JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许jQuery,也许不是,但是当我点击一个链接时,我该如何做,例如。常见问题解答到常见问题div盒子?我的意思是,如果它的底部,然后你只需点击该链接,然后去它..



维基百科有它..
http://en.wikipedia.org/wiki/USA
内容 ..当你点击你的话。

解决方案

这不是Javascript,那些是锚链接。请参阅: http://www.w3.org/TR/html401/struct/links .html



基本上,你可以这样链接:

 < a href =#FAQ>常见问题< / a> 

然后在您要链接的内容上方:

 < a name =FAQ/> 

或者,您可以使用相同的链接并将FAQ部分标题的ID设置为FAQ ,如下所示:

 < h1 id =FAQ>常见问题解答< / h1> 


Maybe jQuery, maybe not, but how do i do so like when you click on a link eg. FAQ it goes to the FAQ div box? I mean if its on the bottom then you just click on that link and then it goes to it..

Wikipedia have it.. http://en.wikipedia.org/wiki/USA The links in the "Contents".. when you click you get to it..

解决方案

That's not Javascript, those are anchor links. See: http://www.w3.org/TR/html401/struct/links.html

Basically, you'd link as such:

<a href="#FAQ">FAQ</a>

Then above the content you're linking to:

<a name="FAQ" />

Alternatively, you could use the same link and set the ID of the FAQ section header to "FAQ", like so:

<h1 id="FAQ">FAQs</h1>

这篇关于转到#div框JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆