arthell
06-06-2005, 10:29 AM
I've only just started reading up on Javascript/DHTML/etc. so there's a good chance this is just a simple mistake on my part, but i can't for the life of me get this to work. After two days of searching I haven't found much help.
What I'm trying to do is create a single javascript function that I can use to toggle one style (visibility) on multiple divs, but at different times.
The basic idea behind the function:
function switch()
{
if (document.getElementById('divrecievedfromvariable').style.visibility == 'hidden')
{ document.getElementById('divrecievedfromvariable').style.visibility = 'visible' }
else
{ document.getElementById('divrecievedfromvariable').style.visibility = 'hidden' }
}
What I originally tried to do with the above was to update a variable during the onClick, which I then tried to insert into the getElementById(), but I've had zero luck with every method I've tried.
Please tell me there's a way to stick a variable inside there. :D
Thanks in advance for any help.
What I'm trying to do is create a single javascript function that I can use to toggle one style (visibility) on multiple divs, but at different times.
The basic idea behind the function:
function switch()
{
if (document.getElementById('divrecievedfromvariable').style.visibility == 'hidden')
{ document.getElementById('divrecievedfromvariable').style.visibility = 'visible' }
else
{ document.getElementById('divrecievedfromvariable').style.visibility = 'hidden' }
}
What I originally tried to do with the above was to update a variable during the onClick, which I then tried to insert into the getElementById(), but I've had zero luck with every method I've tried.
Please tell me there's a way to stick a variable inside there. :D
Thanks in advance for any help.