Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to display loading prompt by creating elements using javascript
JavaScript
var text = document.createElement('div');
                                text.innerHTML = '<br/><center>Loading........Please Wait!</center>';
                                text.style.height = "80px";
                                text.style.width = "350px";
                                text.style.background = "#000";
                                text.style.opacity = 0.7;
                                text.style.color = '#fff';
                                var header = document.createElement('span');
                                header.innerHTML = "";
                                header.style.height = "50px";
                                header.style.width = "350px";
                                header.appendChild(text);
                                header.style.position = "absolute";
                                header.id = "Loadingmsg1";
                                $(header).css('top', '250px');
                                $(header).css('left', '300px');
                                document.body.appendChild(header);

When i debug this code on chrome once the last line is excuted it shows up the message but not on IE(tested on ver 9)
where i am getting wrong? Please help
Posted
Comments
Devang Vaja 17-Sep-12 5:55am    
sneha ji what error IE gives??
Dexter11 17-Sep-12 6:00am    
it doesn't give any error

1 solution

XML
============================================================
INSTRUCTIONS.

This is a MUTI-PART Script.

============================================================
PART I.
Copy code below into <HEAD> section of your HTML pages
============================================================

<SCRIPT TYPE="text/javascript" LANGUAGE="javascript">

<!-- PreLoad Wait - Script -->
<!-- This script and more from http://www.rainbow.arch.scriptmania.com

function waitPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';
}else{
if (document.layers){ //NS4
document.prepage.visibility = 'hidden';
}
else { //IE4
document.all.prepage.style.visibility = 'hidden';
}
}
}
// End -->
</SCRIPT>


============================================================
PART II.
Add the onLoad event, as shown below, to your <BODY> tag:
============================================================

<BODY onLoad="waitPreloadPage();">


============================================================
PART III.
Copy codes below to immediately after <BODY> tag.
============================================================

<DIV id="prepage" style="position:absolute; font-family:arial; font-size:16; left:0px; top:0px; background-color:white; layer-background-color:white; height:100%; width:100%;">
<TABLE width=100%><TR><TD><B>Loading ... ... Please wait!</B></TD></TR></TABLE>
</DIV>
 
Share this answer
 
Comments
Dexter11 17-Sep-12 6:05am    
Sorry my mistake i didn't mention this ,the loading message is not while page loads it's on click of a button where i am passing some data to handler file(using jsonp) in loop and once all the data is send the message is removed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900