html 空链接 href="#"与href="javascript:void(0)"的区别_HTML/Xhtml_网页制作

WBOY
Release: 2016-05-16 16:41:54
Original
1134 people have browsed it

#包含了一个位置信息
默认的锚是#top 也就是网页的上端
而javascript:void(0) 仅仅表示一个死链接
这就是为什么有的时候页面很长浏览链接明明是#但跳动到了页首
而javascript:void(0) 则不是如此
所以调用脚本的时候最好用void(0)
你可使用如下例子来测试一下:
代码



提示:您可以先修改部分代码再运行
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!