I'd like to show a progress image loader only when the user clicks on submit on my html form but at the moment the progress image loader is displayed also when the user reloads the page... so I'd like to isolate the event only a clicked button (submit) without having the progress image loader displayed when the user reloads the page. I provide an example in order to show what I looking for in pure javascript.
Any help is appreciated.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="pragma" content="no-cache">
<meta name="robots" content="noindex, nofollow">
<title>BackUp</title>
<link rel="stylesheet" type="text/css" href="backup.css">
<script language="javascript" type="text/javascript">
function StartProgress() {
ProgressImage = document.getElementById('progress_image');
document.getElementById("progress").style.display = "block";
setTimeout("ProgressImage.src = ProgressImage.src", 100);
return true;
}
</script>
</head>
<body onUnload="StartProgress()">
<div class="mainbox">
<div class="box1">
<span class="title">BackUp</span>
</div>
<div class="cleardiv"></div>
<div class="box2">
<form onSubmit="return StartProgress()" action="backup.php" method="post">
<input class="backup_button" type="submit" name="submit" value="BackUp">
</form>
</div>
<div class="cleardiv"></div>
<div style="display: none" id="progress"><img id="progress_image" src="css/busy.gif" alt="BackUp in progress..."></div>
<div class="cleardiv"></div>
</div>
</body>
</html>