This topic is locked

Loading... Please Wait on ADD/EDIT page

7/4/2011 1:53:20 AM
PHPRunner Tips and Tricks
S
sgchan author

I am a novice programmer but I just want to share this piece of code, which loads a "Loading... Please Wait" with the spinning wheel on a Add/Edit page.
Add the below at the top of the page, e.g. just above the <STYLE> tab:

<script language=javascript type=text/javascript>

function PreloadPage() {

if (document.getElementById){

document.getElementById('prepage').style.visibility='hidden';

}else{

if (document.layers){

document.prepage.visibility = 'hidden';

}

else {

document.all.prepage.style.visibility = 'hidden';

}

}

}

// End -->

</SCRIPT>


Add the below after the <BODY> tag:

<DIV

style="Z-INDEX: 100; POSITION: absolute; FILTER: alpha(opacity = 50); BACKGROUND-COLOR: #000000; WIDTH: 100%; FONT-FAMILY: arial; HEIGHT: 1200px; FONT-SIZE: 16px; TOP: 0px; LEFT: 0px; opacity: 0.2; layer-background-color: white"

id=prepage>

<TABLE width="100%" height="100%">

<TBODY>

<TR vAlign=middle>

<TD align=center><B><FONT color=#ffffff>Loading... Please wait!</FONT><BR><BR><BR><IMG border=0 alt=""

src="images/indicator.gif"></B><BR><BR><BR><BR><BR><BR><BR></TD></TR></TBODY></TABLE></DIV>


Please adjust the width and height of the overlay according to your page's dimensions.
Finally... add this as part of the <BODY> tag:

onload=PreloadPage();

Hence the <BODY> tag should like the following:

<BODY onload=PreloadPage(); {$bodyattrs}>


Hope you find this useful.