Ada*_*itt 1 html javascript jquery internet-explorer-8
我有以下链接在IE8以外的所有浏览器中正常运行.href中的代码是否会覆盖onclick属性?在IE8中,href被执行但是onlick却没有.有人可以帮忙吗?
<a href="javascript:void(0);" type="submit" onclick="$('#loginForm').submit();">Log in</a>
为什么不使用这样的东西?
<a href="#" id="example>Log in</a>
然后使用javascript(使用jQuery库)
$("#example").click(function(e) {
  e.preventDefault(); //Prevent the href from jumping to the top
  $('#loginForm').submit(); //Submit the form
});
我建议这是因为使用内联JavaScript不是一个好习惯.请阅读此处了解原因 - > http://robertnyman.com/2008/11/20/why-inline-css-and-javascript-code-is-such-a-bad-thing/
| 归档时间: | 
 | 
| 查看次数: | 3392 次 | 
| 最近记录: |