Hi,
I’ve been trying to get a really simple ‘please wait…’ message to work on an onclick event, before submitting a form. I’ve seen some people do the same thing with a ‘preload’ message (ie when the new page loads, not when the old page exits), but that does not work for me, as the delay happens while my server side database searches, not as the page actually loads in the browser.
Here is my attempt at a solution. It does not work, and all that happens is that the form is submitted.
In JavaScript Include file:
[CODE]function submitNow()
{
document.getElementById(“mainbody”).style.visibility = “hidden”;
document.getElementById(“waiting”).style.visibility = “visible”;
document.getElementById(“waiting”).value = “Please wait …”;
window.setTimeout(‘letsGo()’, 500);
}
function letsGo()
{
document.forms[0].submit();
}
In body:
[CODE]<div id=”waiting” style=”z-index:9999999;visibility:hidden;”></div>
<div id=”mainbody”>A whole load of stuff including
<form> …
<img src=”icons.png” name=”srch1″ alt=”Search” onmouseover=”somefunction()” onclick=”submitNow()” style=”cursor: pointer;”/>
</form>
</div>
Seems extremely simple. So why doesn’t it work? I’ll freely admit my JavaScript sucks … so be gentle.
Many thanks for your thoughts,
BMA