Thu Jan 17, 2013 1:44 am
<html>
<head>
<title>avoid multiple submit Example</title>
<script type="text/javascript">
var submitIsPressed = false;
function WasteTime() {
//' Sleeping to 10 seconds
}
function checkBeforeSubmit(){
if(!submitIsPressed) {
document.getElementById("buttonSub").disabled="disabled";
setTimeout('WasteTime()', 10000);// As loading-Remove this line
submitIsPressed = true;
return submitIsPressed;
}
return false;
}
</script>
</head>
<body>
<center>
<form action="#" method="POST" onsubmit="return checkBeforeSubmit()">
<table border="1">
<tr>
<td><strong>username:</strong></td><td><input type="text" name="username" />
</tr>
<tr>
<td><strong>password:</strong></td><td><input type="text" name="password" />
</tr>
<tr>
<td colspan="2">
<center><input type="submit" value="submit" id="buttonSub" />
</td>
</form>
</center>
</body>
</html>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.