Jump to content

What is wrong with this simple hide code:


Humpty

Recommended Posts

[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]
Link to comment
https://forums.phpfreaks.com/topic/8011-what-is-wrong-with-this-simple-hide-code/
Share on other sites

Archived

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

×
×
  • 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.