-
<div></div>
Hello,
Please help me here. I have NEVER worked with these div tags, but what I want to do is display a message like "Loading please wait" and then the rest of my page.
I have a page with a whole lot of select boxes which takes long to load and want to display a message while it all loads - something like..
Code:
.
.
.
<div id="TranLoading" style="position:absolute; left: 0px; top: 0px; visibility: hidden">
<table height=100 width=100%>
<tr>
<td valign=bottom align=center>
<font face="Arial, Verdana, Helvetica" size=4 color=#001a70>
<b>Please wait!!</b>
</td>
</tr>
</table>
</div>
<div id="tranloaded">
//here I'll show all my select boxes
</div>
How do I do this??
Thanks,
T
-
First, set the TranLoading-layer to visible, and the TranLoaded to hidden...
then use the onLoad-event for the body tag, and call a function which does:
TranLoading.style.visibility = "hidden";
TranLoaded.style.visibility = "visible";
In netscape:
document.layers["TranLoading"].visibility = "hidden";
document.layers["TranLoaded"].visibility = "visible";
This should be working. Let me know if there's any problem...
-
For netscape compatability you will need to detect which browser is being used and do a document.writeln() to write the DIV tag for IE or the LAYER tag for NS.
Something like this:
Code:
if (document.all) //IE
{
document.writeln("<div id=\"TranLoading\" style=\"position:absolute; left: 0px; top: 0px;\">");
}
else if (document.layers) //Netscape
{
document.writeln("<layer id=\"TranLoading\" pagex=\"0\" pagey=\"0\" width=\"200\" height=\"200\" z-index=\"100\" >");
}
And do the same for the ending DIV/LAYER tags
And.... set Response.Buffer=False at the beginning of your ASP page do it displays the HTML as it hits it. Put the ASP script that hits your database AFTER your HTML that outputs the above message.
-
Thanks guys,
As I said I've never used this before and still am in the dark a bit.
Do I put this in the body onload tag/code??
How do I do this.....
Code:
<body onload="TranLoading.style.visibility" ; bgcolor="#F1F2F5" text="black">
How/where do I set the visibility to VISIBLE or HIDDEN??
I know I'm being a bit thick here.................
T
-
Create a function that will be your handler for the window_onload event. In that function make the message DIV hidden. Don't stick code in the attributes. It makes your code harder to read and thus harder to maintain. Keep code in functions and just put the function names in the event handler attributes.
Are you supporting Netscape? Cuz that opens a new can of worms on how to pull this off.
-
monte96,
your right, but NN6 does not use layer tag!,
but most of all browser use div tag!!,
it's mostly when you want to hide show of move layer:
Code:
function hideSubMenu()
{
if(document.layers){
document.layers[lastMenuItem].visibility="hidden";
}
else if(document.all){
document.all[lastMenuItem].style.visibility = "hidden";
}
else if(document.getElementById){
document.getElementById(lastMenuItem).visibility="hidden";
}
}
-
Great... that's one more reason to hate NS.....
So did they break compatability with their previous versions or does it at least still support the layer tag?
-
their previous still use layer tag!!
but for some reason the nn6 version use div,
i find that NN6 act more like MSIE than the previous version of NN,
problably just to make it more complicated!!
-
But.. does NS6 still allow the use of Layer tags? If not, then they have majorly hosed alot of formerly cross-compatible code...
-
i don't think so,
try it, layer in NN6 don't work,
OR your have to use them differntly,
maybe,
i did not try but,
i know that now they have style, so maybe you can do:
<layer name="test" style="top:0;left:0;">
cuz this don't position it like it suppose
<layer name="test" top="0" left="0">
-
Couldn't you just use window.open() in script tags to open a new window that says "Page Loading" then close it in the ONLOAD event of the main page?
Just a thought...
Chris