标签:标签 font ext 哪些 script 滚动 oct class 代码
<a href=‘#‘>click</a>实验证明,页面上能不用这个值就最好不要用这个#,这个#会让你的页面瞬间滚动到页面的顶部,我不知道已经踩了多少次坑了,就是因为这个‘#’
<a href="javascript:;" onclick=‘demo()‘>hello</a>这条语句跟<a href="javascript:void(0)" onclick=‘demo()‘>world</a>这条我一开始看一个博客说有一点区别,然后我就demo了一下,感觉没区别啊
上代码,你们可以测试一下
<!DOCTYPE html>
<html>
<head>
<meta charset=‘UTF-8‘>
<title>a</title>
</head>
<body>
<a href="javascript:;" onclick=‘demo()‘>hello</a>
<a href="javascript:void(0)" onclick=‘demo()‘>world</a>
</body>
<script type="text/javascript">
function demo(){
alert(‘hello‘);
}
</script>
</html>
感觉一样的,但是看到有博客是这样解释的
a href="javascript:;" onclick="demo()"与<a href="javascript:void(0)" onclick=‘demo()‘>world</a>的区别只是执行了一条空的js代码
其实我不太懂这句话是什么意思,有哪些大神能帮忙解释一下就最好不过了
标签:标签 font ext 哪些 script 滚动 oct class 代码
原文地址:http://www.cnblogs.com/lwwen/p/6015168.html