Thursday, October 14, 2010

Delaying Form Submission

It's been a while since my last post. I've been very busy lately with the new assignment and all but since somebody asked me how to delay a form submission in javascript i suddenly remembered that I have this blog. so here goes:
here's your javascript code:
function submitForm() {
  document.myForm.submit();
}

function delaySubmit() {
  setTimeout("submitForm()", 2000); 
  //2000 is the time delay in milliseconds
}
here's your form code:
<form name="myForm"><input type="text" name="myTextBox" />
  <input type="button" name="submitButton" value="Delayed Submit" onclick="delaySubmit()" />
</form>
here's the actual:


No comments: