Click to See Complete Forum and Search --> : mozilla gives me a headache


pintel
04-14-2003, 05:43 PM
the following code works alright on IE but mozilla gives me the following error:

Error: testhide is not defined

help. Anyone?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>

<script language="JavaScript">
function test() {
testhide.style.display="none";
}
</script>
</head>

<body onload="test();">

<span id="testhide">Testing</span>


</body>
</html>

khalidali63
04-14-2003, 05:51 PM
Mozilla gives you headach because the code you are writing

testhide.style.display="none";

is not the correct format in W3C standard compliant browsers

use the following patter

document.getElementById("testhide").style.visiblity="hidden";

to un hide an object

document.getElementById("testhide").style.visiblity="visible";

Cheers

Khalid

khalidali63
04-14-2003, 06:11 PM
Originally posted by Dave Clark
I don't know that there is anything wrong with using display='none'.
Dave
Nope there isn't anything wrong with that nor I was referring to that,

:p

I was pointing to this line

testhide.style

being wrong

Cheers

Khalid

pintel
04-14-2003, 06:44 PM
tnx guys