Humpty Posted April 21, 2006 Share Posted April 21, 2006 [b]*** RESOLVED***[/b]G'day Guys,I can't workout why, (now that I have added a variable to my code), the code won't work.Please excuse the spaces in the code below, the forum wouldn't allow me to post while the code was fully intact.I am trying to shoe / hide a table. Works great while the element ID in the funtion is static, but adding the variable kills it. Am I doing something wrong?The funtions:(they are in the < h ead> tag and inside a < s cript> tag.)[code]f unction show(TheID_ofTheItem) { document.getElementById(TheID_ofTheItem).style.display = ''; } f unction hide(TheID_ofTheItem) { document.getElementById(TheID_ofTheItem).style.display = 'none'; } [/code]The call to the functions:(again please note that in my code there is only a spave between the 'a' and the 'href' words.[code]< a h r e f ="javascript:show('tblCustom');">show</a> ¦ < a h r e f ="javascript:hide('tblCustom');">hide</a>[/code]Thanks for any help.CODE THAT WORKS / CHANGES MADE:[code]<a href="#" onClick="show('tblCustom');">show</a> ¦ <a href="#" onClick="hide('tblCustom');">hide</a>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/8011-what-is-wrong-with-this-simple-hide-code/ 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.