jamiller
01-20-2007, 12:49 AM
As in my last post, remember the fact that I'm fairly new to JS but do have a lot of knowledge of Flash ActionScript.
So on to my question.
I am trying to make a function out of a JS script that I've been using a lot but cannot get this to work. I'm hoping that it's an easy syntax fix. I've tried everything.
In an external JS file that I DO have attached to my html doc, I have the code:
function open(openid) {
if(document.getElementById(openid).style.visibility=='hidden') {
document.getElementById(openid).style.visibility='visible'
} else {
document.getElementById(openid).style.visibility='hidden'
}
}
And in my html code I have:
onclick="open('import')" where 'import' is the ID I gave to a table.
This worked fine when it was all internal, like this:
onclick="if(document.getElementById('import').style.visibility=='hidden') {document.getElementById('import').style.visibility='visible';} else {document.getElementById('import).style.visibility='hidden';}"
If I can't get it to work then I guess I'll just go back to having to have a lot of code. I just wanted to clean things up a bit.
Thanks!
So on to my question.
I am trying to make a function out of a JS script that I've been using a lot but cannot get this to work. I'm hoping that it's an easy syntax fix. I've tried everything.
In an external JS file that I DO have attached to my html doc, I have the code:
function open(openid) {
if(document.getElementById(openid).style.visibility=='hidden') {
document.getElementById(openid).style.visibility='visible'
} else {
document.getElementById(openid).style.visibility='hidden'
}
}
And in my html code I have:
onclick="open('import')" where 'import' is the ID I gave to a table.
This worked fine when it was all internal, like this:
onclick="if(document.getElementById('import').style.visibility=='hidden') {document.getElementById('import').style.visibility='visible';} else {document.getElementById('import).style.visibility='hidden';}"
If I can't get it to work then I guess I'll just go back to having to have a lot of code. I just wanted to clean things up a bit.
Thanks!