Jump to content

Archived

This topic is now archived and is closed to further replies.

coldkill

*SOLVED* JS not working

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

Share this post


Link to post
Share on other sites
Didn't work. Strange thing is the exact same JS function works on another site I have it on.

Share this post


Link to post
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,,

Share this post


Link to post
Share on other sites
Thanks.
The reason it didn't work from the file was because i put the whole URL in instead of just the folder ie js/main.js

Thanks for help

[b]::SOLVED::[/b]

Share this post


Link to post
Share on other sites

×

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.