Jump to content


Photo

What is wrong with this simple hide code:


  • Please log in to reply
No replies to this topic

#1 Humpty

Humpty
  • Members
  • PipPipPip
  • Advanced Member
  • 132 posts

Posted 21 April 2006 - 12:51 AM

*** RESOLVED***

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.)

f unction show(TheID_ofTheItem) { 
document.getElementById(TheID_ofTheItem).style.display = ''; 
} 

f unction hide(TheID_ofTheItem) { 
document.getElementById(TheID_ofTheItem).style.display = 'none'; 
}


The call to the functions:
(again please note that in my code there is only a spave between the 'a' and the 'href' words.
< a  h r e f ="javascript:show('tblCustom');">show</a> ¦ < a  h r e f ="javascript:hide('tblCustom');">hide</a>

Thanks for any help.



CODE THAT WORKS / CHANGES MADE:
<a href="#" onClick="show('tblCustom');">show</a> ¦ <a href="#" onClick="hide('tblCustom');">hide</a>

- Humpty
  #> Where does the light go when it goes out?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users