javascript visibility toggle, always starts "visible" instead of "hidden" (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


phillipu -> javascript visibility toggle, always starts "visible" instead of "hidden" (5/10/2004 15:21:06)

Hi all, I am using some javascript to toggle the visibility of a table, the toggle is working fine, my prob is that whenever the page with the toggle loads, it loads my table as "visible", i need the page to load with the table to toggle as "hidden", then the user can click the text link and the table becomes "visible".

Here is the javascript code -

<script language="JavaScript">
function toggle(target, iNo)
{
	obj=document.getElementById(target+String(iNo));
	obj.style.display=( (obj.style.display=='none') ? '' : 'none');
}
</script>


this code is the onclick for the toggle -

<td bgcolor="#F4F4F4" width="540" class="data" onClick="toggle('status',1)" id="rfcpe_status" style="cursor:hand">


this code is the table that is toggled -

<table width="700" border="0" cellspacing="2" cellpadding="2" bgcolor="#FFFFFF"  id="status1">


Thanks,

Phillip




Giomanach -> RE: javascript visibility toggle, always starts "visible" instead of "hidden" (5/11/2004 8:12:32)

You will need to use CSS rather than JavaScript for this. It's much easier[:)]

The coding would be :

<head>
<style type="text/css">
#invis{
visibilty: hidden;
}
</style>

Then you would need:

<div id="invis">
<table>
.......The Invisble Table.......
</table>
</div>

HTH

Dan




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875