/    Sign up×
Community /Pin to ProfileBookmark

Help with style.display

Is it possible to on the fly hide and show tables?

Here is what I am trying to do:
I have a php script building a web page from a database. This can take a while to happen depending on the user’s request.

So, I have 2 tables. 1 looks like this:

[code]
<TABLE ID=”tblPleaseWait” width=100%>
<tr>
<td align=center>
<img border=0 src=’images/pleasewait.gif’></img>
</td>
</tr>
</TABLE>

[/code]

That is the one that is displayed as the web page appears initially. It’s an animated gif.

Then I have the main table which has the main body of it built via the script. Starts off looking like this:

[code]
<TABLE ID=”tblMain” WIDTH=100% STYLE=”DISPLAY:NONE”>
<TR VALIGN=TOP>
<TD ALIGN=CENTER>
.
.
.
[/code]

The <Body> tag has an onload running a Javascript function that looks like this:

[code]
<SCRIPT LANGUAGE=”JavaScript”>
function AllLoaded()
{
tblPleaseWait.Style.Display=’NONE’;
tblMain.Style.Display=”;
}
</SCRIPT>
[/code]

Ok, so I have tried doing this function all ways I can think of to hide the tblPleaseWait, and show the tblMain. What am I doing wrong here? I want to keep the html looking like it does. I don’t want to do a bunch of CSS coding block or anything if I can avoid it. I seem to be missing something in the function that tells JavaScript what the object is. Thanks for any help…

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisFeb 12.2003 — [i]Originally posted by Whoever [/i]

[B]<SCRIPT LANGUAGE="JavaScript">

function AllLoaded()

{

tblPleaseWait.Style.Display='NONE';

tblMain.Style.Display='';

}

</SCRIPT>[/B]
[/QUOTE]
Try this:

[font=monospace]<SCRIPT>

function AllLoaded() {

document.getElementById("tblPleaseWait").style.display="none";

document.getElementById("tblMain").style.display="block";

}

</SCRIPT>[/font]

Especially notice the case of the styles. If "block" doesn't work, try "inline".
Copy linkTweet thisAlerts:
@WhoeverauthorFeb 12.2003 — Perfect. That worked great. Thank you. ?
×

Success!

Help @Whoever spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...