View Full Version : Javascript functions

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') {
} else {

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.


01-20-2007, 12:56 AM
Try changing the function name to openDiv or something other than open. See if that fixes it.

Hope this helps.

01-20-2007, 12:59 AM
Ha!!!! You rock Bro!! Thanks a ton :)

01-20-2007, 01:05 AM
Not a problem, let us know if you need any more help.

01-20-2007, 01:12 AM
Well I'm having a real problem with swapping images. Refer to this post...


Thanks again! :)