Jump to content

*SOLVED* JS not working


coldkill

Recommended Posts

I'm making a website where the navigation is supposed to be hidden until the user clicks on the roll out button and it displays the links. Only problem is the JavaScript doesn't change the style tag for the table with the links in which has the style attribute.

Here is the javascript [code]function hide_toggle( id )
{
    document.getElementById(id).style.display=document.getElementById(id).style.display=="none" ? "" : "none"
}
[/code]

here is the html (dynamically generated)
[code]<!-- Menu Item 1-6 -->
    <tr><td>
     <div class="mhead">
     <input name="" type="button" title="Asssault AirLift: AirLift" onclick="javascript:hide_toggle( 'linkcat1' )" value="AirLift" />
    
     </div>

     <div class="menu">
      <table  id="linkcat1" cellpadding="0" cellspacing="0" border="0" style="display:none">
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=home" title="Assault AirLift: Go Home!!">Home</a></td></tr>
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=contact&amp;c=gen" title="Assault AirLift: Contact Us! Yes US!">Contact Us</a></td></tr>
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=contact&amp;c=app" title="Assault AirLift: It's unpaid btw ¬¬">Job Application</a></td></tr>
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=contact&amp;c=bug" title="Assault AirLift: NOOOOOO A BUG!!">Bug Report</a></td></tr>
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=memlist" title="Assault AirLift: Our members r0xers your s0xers!">Member's Listing</a></td></tr>

        
      </table>
     </div>
    </td></tr>[/code]
The above is one menu item and isn't the entire menu bar.

Thanks in advance,
Cold
Link to comment
Share on other sites

Hi there,,

The code there seems OK to me,... it shows the navigation links & changes the table style display correctly once we have clicked on the button,, (tested with both IE & FF)
[code]
<html>
<body>
<script type="text/javascript">

function hide_toggle( id )
{
    document.getElementById(id).style.display=document.getElementById(id).style.display=="none" ? "block" : "none"
}
</script>
<!-- Menu Item 1-6 -->
    <tr><td>
     <div class="mhead">
     <input name="" type="button" title="Asssault AirLift: AirLift" onclick="javascript:hide_toggle( 'linkcat1' )" value="AirLift" />
    
     </div>

     <div class="menu">
      <table  id="linkcat1" cellpadding="0" cellspacing="0" border="0" style="display:none">
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=home" title="Assault AirLift: Go Home!!">Home</a></td></tr>
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=contact&c=gen" title="Assault AirLift: Contact Us! Yes US!">Contact Us</a></td></tr>
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=contact&c=app" title="Assault AirLift: It's unpaid btw ¬¬">Job Application</a></td></tr>
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=contact&c=bug" title="Assault AirLift: NOOOOOO A BUG!!">Bug Report</a></td></tr>
        <tr><td><a href="http://www.assault-airlift.com/index.php?module=memlist" title="Assault AirLift: Our members r0xers your s0xers!">Member's Listing</a></td></tr>

      </table>
     </div>
    </td></tr>
</body>
</html>
[/code]
Is it what you were looking for,...?

hoping it helps,

l8tr,,
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.