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

http://www.itjxue.com  2015-08-06 23:02  来源:未知  点击次数: 

今天解决一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>

(责任编辑:IT教学网)

更多

推荐Javascript/Ajax文章