There is one other catch. Peter Brunone's article displays his "Please Wait" message before the web page has fully loaded. Since the web page has not loaded yet, the DIV area is assured to be at the top of the browser window and will always appear. This may not be true for a web page that has fully loaded. If the user has to scroll to the bottom of a long web page in order to click a button that executes our do_totals1() function, then the DIV area may display outside of the browser viewing area, defeating the purpose. A slight modification of the code will fix this, however.
<script language="Javascript">
function do_totals1()
{
document.all.pleasewaitScreen.style.pixelTop = (document.body.scrollTop + 50)
document.all.pleasewaitScreen.style.visibility="visible";
window.setTimeout('do_totals2()',1)
}
function do_totals2()
{
calc_totals();
document.all.pleasewaitScreen.style.visibility="hidden";
}
<script>
The only difference between this code and the code shown previously is that the DIV area pixelTop property is set to be fifty pixels below the top of the visible page. This will guarantee that the "Please Wait" message box will always appear onscreen.
Joseph McLaughlin is a technical consultant from Sacramento, California.