[quote]My skills in javascript are still at beginner stage I was assuming it should work because it worked in IE. I forget where I found this script, but it was explained that the varible gets passed from the eventhandler to the script and becomes the element.
So now I need to figure out whether the varible name in the eventhandle needs to be defined or the varible obj in the script.
Thanks anyway,
Silk
[/quote]
I was being SARCASTIC. What you don’t know is that Internet Explorer will automatically pollute the JavaScript namespace with references to element objects with IDs. There is no standard that says it has to do that. It is another Microsoft “feature” they come up that allows JavaScript coders to use less code - hence the laziness.
And it is a basic idea of computer programming that a variable needs to be declared and assigned a value in order to “use” it. If you notice the source you posted does not do that at all.
The proper way to get an object reference to an HTML element of a document given an ID is to use a method of the document object called getElementById()
So to revise your code…
[code]function disappear(obj) {
// quit if obj was not defined to avoid error messages
if (obj === undefined) return;
// following code assumes obj is an element
if (obj.style.display == “”) {
obj.style.display = “none”;
}
else {
obj.style.display = “”;
}
}
Click here to display or hide the Forums...
[/code]
openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7