Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

showing DIV statements while downloading

Status
Not open for further replies.

spicymango

Programmer
May 25, 2008
119
CA
Hi,

I want to display a message like "In Progress" while my page is still loading. I am trying to achieve it by displaying a DIV, and then hidding it. My code is below. These images gets downloaded fast so hard to tell and test, but based on my logic you see any problem with this?

Code:
<html>
<head><title></title>
<script>
function testing()
{

document.getElementById('mydiv').style.display = 'none';
}

</script>

</head>
<body >
 
 <div id="mydiv" style="position:absolute;  top:130px; left:200px" >
<table><tr><td  height= 200 width=500 valign=center  align=center  bgcolor=yellow><h3>In Progress</h3></td></tr></table>
</div>



<table>
<tr><td><img src="[URL unfurl="true"]http://www.astray.com/static/earth-huge.png"[/URL] border=0 ></td></tr>
<tr><td><img src="[URL unfurl="true"]http://www.astray.com/static/earth-huge.png"[/URL] border=0 ></td></tr>
<tr><td><img src="[URL unfurl="true"]http://www.astray.com/static/earth-huge.png"[/URL] border=0 ></td></tr>
<tr><td><img src="[URL unfurl="true"]http://www.astray.com/static/earth-huge.png"[/URL] border=0 ></td></tr>
<tr><td><img src="[URL unfurl="true"]http://www.astray.com/static/earth-huge.png"[/URL] border=0 ></td></tr>
</table>
 
 
<script> 
testing();
</script>


</body>
</html>
 
Hi

You should hide the [tt]div[/tt] when the content finished loading. Use only this piece of JavaScript :
JavaScript:
window[teal].[/teal]onload[teal]=[/teal][b]function[/b][teal]()[/teal] [teal]{[/teal]
  document[teal].[/teal][COLOR=darkgoldenrod]getElementById[/color][teal]([/teal][green][i]'mydiv'[/i][/green][teal]).[/teal]style[teal].[/teal]display [teal]=[/teal] [green][i]'none'[/i][/green][teal];[/teal]
[teal]}[/teal]


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top