coldkill Posted April 20, 2006 Share Posted April 20, 2006 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&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>[/code]The above is one menu item and isn't the entire menu bar. Thanks in advance,Cold Quote Link to comment https://forums.phpfreaks.com/topic/7972-solved-js-not-working/ Share on other sites More sharing options...
wildteen88 Posted April 20, 2006 Share Posted April 20, 2006 change "" to [b]"block"[/b] instead. Quote Link to comment https://forums.phpfreaks.com/topic/7972-solved-js-not-working/#findComment-29109 Share on other sites More sharing options...
coldkill Posted April 21, 2006 Author Share Posted April 21, 2006 Didn't work. Strange thing is the exact same JS function works on another site I have it on. Quote Link to comment https://forums.phpfreaks.com/topic/7972-solved-js-not-working/#findComment-29361 Share on other sites More sharing options...
coldkill Posted April 24, 2006 Author Share Posted April 24, 2006 Any ideas? Still not working. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/7972-solved-js-not-working/#findComment-30181 Share on other sites More sharing options...
GBS Posted April 24, 2006 Share Posted April 24, 2006 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,, Quote Link to comment https://forums.phpfreaks.com/topic/7972-solved-js-not-working/#findComment-30247 Share on other sites More sharing options...
coldkill Posted April 24, 2006 Author Share Posted April 24, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/7972-solved-js-not-working/#findComment-30288 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.