ie6下点a标签不会submit把javascript:void(0)改成###


今天解决一BUG,在ie6下点a标签不会submit,原来在a的href上写的是javascript:void(0);把javascript:void(0)改成###,问题解决.但是如果这个html是程序员喷的,那可就要走大流程了.咨询大师,于是留下了这千古绝唱.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <title></title>
 <script type="text/javascript">
window.onload = function() {
    document.getElementById('a1').onclick = function() {
        setTimeout(function() {
            document.forms[0].submit();
        }, 1);
    }
 }
 </script>
</head>
<body>
 <form action="VoteSubmit.aspx" id="form1">
 <input type="text" id="t1" />
 </form>
 <a href="javascript:void(0)" id="a1">aaa</a>
</body>
</html>

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3