Jump to content

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

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.