开发者

Go to #div box JavaScript

开发者 https://www.devze.com 2022-12-20 05:08 出处:网络
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..

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 开发者_C百科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>


First, add an id to the HTML element. This will serve as the anchor.

For example:

id="mybox"

Now simply add a link to #mybox on that page. E.g. example.com/index.html#mybox

<a href="#mybox">Box</a>

As mentioned these are not anything to do with javascript; it is not required for this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号