...

View Full Version : Combining If/Else with doc.write w/ Hidden/Visible - Possible?



paprbkwrtr
09-23-2005, 01:10 AM
I need to comine and if / else statement with a hidden / visible statement but not sure how you do it.

My problem is so:
I have members and non-members coming into a site. I want certain tables of information to be hidden for non-members and visible for members. I am not sure of the syntax for combining if/else - doc.write and hidden/visible. Can someone help?

an example:
<script type="text/javascript">
if (cbol_user == 'true')
{
document.write("tell it show a table here")
}
else
{
*Tell it to hide the table here*
}
</script>

I am not sure how you add hidden and visible variable to this. Can someone help me on this. This is the first time I have encountered someone asking for such a combination.

Thanks.

CrAzY_J
09-23-2005, 01:58 AM
<script type="text/javascript">
/* Code to check for user here */

if(user)
document.getElementById("tableid").style.display="block";
else
document.getElementById("tableid").style.display="none";
</script>

Doesn't get simpler then that :rolleyes: :thumbsup:

paprbkwrtr
09-23-2005, 04:12 PM
Thanks! I thought it was more complicated than that which is probably why I got stuck on it.

Cheers!

K



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum