input表单提交时,我们可以让该提交按钮disabled,从而防止用户重复提交表单,但是,如果是a标签,或者一个图片提交表单时,我们应该如何去做呢.
这个做法可以参考下。
-
<!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>
-
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
-
<title></title>
-
<script type="text/javascript" src="jquery1.5.js"></script>
-
<script type="text/javascript">
-
$(document).ready(function(){
-
$("#submit_btn").click(function(){
-
var isDis = $(this).attr("disabled");
-
if(isDis != null && isDis == "disabled"){
-
returnfalse;
-
}
-
$(this).attr("disabled", "disabled");
-
alert("提交操作-------");
-
});
-
});
-
</script>
-
<style type="text/css">
-
.btn_2{
-
font-size:30px;
-
border:1px solid blue;
-
background:#cacaca;
-
padding:20px;
-
}
-
</style>
-
</head>
-
<body>
-
<a id="submit_btn"class="btn_2"><span>提交注册</span></a>
-
</body>
-
</html>
2013-08-04-add