View Full Version : "Please Wait" Message while Function is being Performed
peterinwa
05-07-2003, 08:22 PM
If you go to fatcalories.com (not my website) and click on search you get a message and a graphic asking you to wait while the search is being performed. How do they do that?
On my website I have a simple JS search feature of my own. I tried in vain to change the page display at the beginning of the search function to display a similar message. I even posted about it in another thread a month or so ago.
I determined that the browser doen't make any changes to the page until after any processing is done. So even though the first thing in the search function was to display a message, it didn't happen until the search was complete at which time it still didn't happen because at that point the search results were displayed.
I gave up a month ago. But now I found proof that it can be done.
Rather than discuss my previous failures, I will simply ask... how can it be done?
Thanks, Peter
ACJavascript
05-07-2003, 09:11 PM
Well to me it looks like there using layers to do that... Can you post your script so we can see what you have and were to put some ideas hehe :D
cconn
05-07-2003, 10:06 PM
It appears that they are running ColdFusion on their server.
I've never worked directly with it, but I'm guessing it's there somewhere.
What about the possibility of having a hidden image that you only display just before you run the database access (or whatever).
Danne
05-07-2003, 10:47 PM
If you are doing it only clientside only, you could try something like this:
function showWaitingMsg(display) {
var obj=document.getElementById("waitingMsg");
obj.style.display=display;
}
function startProcess(process) {
showWaitingMsg('block');
setTimeout('process',1);
}
function calculateHeavily() {
// Heavy and timedemading calculations
showWaitingMsg('none');
}
</script>
</head>
<body>
<div id="waitingMsg" style="position:absolute;top:50px;left:50px;padding:20px">
Please wait...</div>
<input type="button" value="Start heavy calcs" onClick="startProcess('calculateHeavily();');">
Didn't test it, but I think it should work...:D
CFMX RULES
05-28-2003, 10:37 AM
Place all this code in your page that takes a while to load
in your head
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
body tag onload event
onLoad="MM_showHideLayers('Eyes','','hide')"
right after the body
<div id="Eyes" style="position:absolute; left:0px; top:150px; width:769px; height:95px; z-index:1; visibility: visible">
<div align="center"><img src="/Images/eyes_pleasewait.gif" width="224" height="150"></div>
</div>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.