PDA

View Full Version : javascript: object required....?


6|00||00|6
10-10-2007, 03:12 PM
my script is in a .js file.
<head>
<script src="myjs.js">
</script>
/*the following is in the myjs.js file*/
function hideall() {
try {
var menu1 = document.getElementById ("menubox1")
var menu2 = document.getElementById ("menubox2")
menu1.style.visibility = "hidden";
menu2.style.visibility = "hidden";
return true;
}catch(e) {
alert(e.description);
}
}
in the html:
<span id="menubox1">blah</span>
<span id="menubox2">blah2</span>
<!-- why does it say object required, the id=menubox1 exists, and the script works, it just gives me an error.