[Javascript] Hide show a TD

Marcelo Wolfgang grillo at gmail.com
Mon Jun 21 10:45:36 CDT 2004


/me bashes head against the wall

:)

damn hurry that I've copy & pasted the script :(

thanks guys


On Mon, 21 Jun 2004 10:25:33 -0500, Peter Brunone <peter at brunone.com> wrote:
> 
> 
>         The double equality sign (==) is a *test* for equality, not an
> assignment operator :)
> 
> Try this:
> 
> document.getElementById(i).style.display = 'none';
> 
> Cheers,
> 
> Peter
> 
> 
> 
> -----Original Message-----
> From: javascript-bounces at LaTech.edu On Behalf Of Marcelo Wolfgang
> 
> Hi list,
> 
> I'm trying to come with a script to hide show layers based on their id,
> everything looks fine, except it ain't changing the style of the TD :(
> 
> Here's my js code :
> 
> <script>
> function showSub(id){
>        alert( document.getElementById(id).style.display) // output
> "none"
>        document.getElementById(id).style.display == 'inline';
>        alert( document.getElementById(id).style.display) // output
> "none" also !!!
> 
>       // I do not even tried to debug the rest of the function
>       // but I bet it won't change the dislplay attribute also.
> 
>        for (i=1;i<5; i++){
>                if (i!= id){
>                        document.getElementById(i).style.display ==
> 'none';
>                }
>        }
> }
> </script>
> 
> and here's the TD :
> 
> <tr>
>        <td><a href="javascript:showSub(1)"><img
> src="images/menu_btProducts_off.gif" width="134" height="23"
> border="0"></a></td> </tr> <tr>
>        <td id="1" style="display:none">
>                <table border="0" cellpadding="0" cellspacing="0">
>                <tr>
>                        <td><img src="images/menu_btShopMedia_off.gif"
> width="134"
> height="22" border="0"></td>
>                </tr>
>                <tr>
>                        <td bgcolor="#20214F"><img src="images/dot.gif"
> width="1" height="1" border="0"></td>
>                </tr>
>                </table>
>        </td>
> </tr>
> 
> Can anyone help me ?
> 
> TIA
> Grillo
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>



More information about the Javascript mailing list