[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

pause to show processing image

Posted on 2010-01-02
3
Medium Priority
?
848 Views
Last Modified: 2012-05-08
I would like to show a 'processing form' image when user clicks submit on a simple html form.
Because my form is very simple the images doesnt even have time to load before the form has been submitted.

How can I delay the submit of the form for 2 seconds?

Below is my javascript to display image on submit.

Ideas would be very helpful!

Many Thanks
<script type="text/javascript">

function loadSubmit() {

ProgressImage = document.getElementById('progress_image');
document.getElementById("progress").style.visibility = "visible";
setTimeout("ProgressImage.src = ProgressImage.src",3000);
//NEED TO WAIT HERE FOR 2 SECONDS!
return true;
}

</script>

Open in new window

0
Comment
Question by:Steve Tinsley
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 26162738
Hello sjtinsley83,

Try : setTimeout("document.myForm.submit();", 3000);


<!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>Wait</title>
<script type="text/javascript">
	function loadSubmit() {
	        ProgressImage = document.getElementById('progress_image');
		document.getElementById("progress").style.visibility = "visible";
		setTimeout("document.myForm.submit();", 3000);	
	}
</script>
</head>
<body>
<form name="myForm" id="myForm" action="http://www.experts-exchange.com">
	<INPUT type=button value="Go to EE" onClick="loadSubmit();">
</form>
<img name="ProgressImage" id="progress" style="visibility:hidden;" src="http://www.bitemehere.com/VisualQuote/Images/PleaseWait.gif" alt="ProgressImage">
</body>
</html>

Open in new window

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 26164739
Alternatively use ajax
0
 
LVL 83

Expert Comment

by:leakim971
ID: 26173148
Thanks for the points! Happy new year!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month20 days, 1 hour left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question