Acoder i have done the impossible :P I had already created a please wait while the next page loads directly after submit and it wait till the next page is loading with animated gif and text saying please wait. please wait.. please wait...please wait....you get the idea
and heres how it works
-
<script>
-
function pwait(count, co, color) {
-
if (count == 1) { document.getElementById("pwimg").src = "images/pwait.gif"; }
-
//border-top: solid 2px black; border-bottom: solid 2px black; border-right: solid 2px black; border-left: solid 2px black;
-
var ftable = document.getElementById("pwtable");
-
if (co == 1) {
-
ftable.style.borderTop = "solid 2px "+color;
-
ftable.style.borderBottom = "solid 2px black";
-
ftable.style.borderLeft = "solid 2px black";
-
ftable.style.borderRight = "solid 2px black";
-
}
-
if (co == 2) {
-
ftable.style.borderTop = "solid 2px black";
-
ftable.style.borderBottom = "solid 2px black";
-
ftable.style.borderLeft = "solid 2px "+color;
-
ftable.style.borderRight = "solid 2px black";
-
}
-
if (co == 3) {
-
ftable.style.borderTop = "solid 2px black";
-
ftable.style.borderBottom = "solid 2px "+color;
-
ftable.style.borderLeft = "solid 2px black";
-
ftable.style.borderRight = "solid 2px black";
-
}
-
if (co == 4) {
-
ftable.style.borderTop = "solid 2px black";
-
ftable.style.borderBottom = "solid 2px black";
-
ftable.style.borderLeft = "solid 2px black";
-
ftable.style.borderRight = "solid 2px "+color;
-
co = 0;
-
}
-
document.getElementById("pleasewait").style.visibility = "visible";
-
document.getElementById("pwaitblur").style.visibility = "visible";
-
var vtop = document.body.offsetHeight/2;
-
var vleft = document.body.offsetWidth/2;
-
document.getElementById("pleasewait").style.top = document.body.scrollTop+document.documentElement.scrollTop+vtop-80;
-
document.getElementById("pleasewait").style.left = document.body.scrollLeft+document.documentElement.scrollLeft+vleft-80;
-
document.getElementById("pwaitblur").style.left = document.body.scrollLeft+document.documentElement.scrollLeft;
-
document.getElementById("pwaitblur").style.top = document.body.scrollTop+document.documentElement.scrollTop;
-
tmp = document.getElementById("pwait").innerHTML;
-
if (tmp == " ") {
-
document.getElementById("pwait").innerHTML = ".";
-
}
-
if (tmp == ".") {
-
document.getElementById("pwait").innerHTML = "..";
-
}
-
if (tmp == "..") {
-
document.getElementById("pwait").innerHTML = "...";
-
}
-
if (tmp == "...") {
-
document.getElementById("pwait").innerHTML = " ";
-
}
-
co = co + 1;
-
count = count + 1;
-
var pwaitint = window.setTimeout("pwait("+count+", "+co+", '"+color+"')", 200);
-
}
-
</script>
-
The Divs
[HTML]
<div id="pwaitblur" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0; opacity: 0.5; -moz-opacity: 0.5; -khtml-opacity: 0.5; filter: alpha(opacity=50); visibility: hidden; background: black;"></div>
<div id="pleasewait" style="position: absolute; top: 50%; left: 50%; width: 200; height: 60; visibility: hidden;"><table width="100%" height="100%" bgcolor="white" style="border-top: solid 2px black; border-bottom: solid 2px black; border-right: solid 2px black; border-left: solid 2px black;" id="pwtable"><tr><td><img src="/images/pwait.gif" id="pwimg"><td width="70%" align="right" style="font-weight: 800;">Please Wait<td id="pwait" width="30%" align="left" style="font-weight: 800;"> </table></div>
[/HTML]
The style
[HTML]
<style>
html,body{ margin:0; padding:0; height:100%; border:none }
</style>
[/HTML]
The onclick event
[HTML]
onclick="pwait(0, 1, 'black');"
[/HTML]
The timeout in the code makes all the difference.
You may copy - paste my code :) good luck and let us see the final result please