"is not defined" errors only in Firefox
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

"is not defined" errors only in Firefox

From: forwardtrends <forwardtrends@gmail.com>
Date: Tue Feb 28 2006 - 20:10:10 CET

I am trying to simply make a div appear and dis-appear. The code I am
using is:

---
if(!document.getElementById) {
 document.getElementById = function() {return null;};
}
function setStyle(element, property, value) {
 element = document.getElementById(element);
 if(element.style) {element.style[property] = value;}
}
function hideDiv() {
	setStyle(handbookPop, 'display', 'none');
}
function showDiv() {
	setStyle(handbookPop, 'display', '');
}
---
But when I use a <body onLoad="javascript:hideDiv();">
or
<a href="#" onClick="javascript:showDiv();">show div</a>
I get "handbookPop is not defined" in Firefox but in IE and Opera it
works fine.
The div looks like:
<div id="handbookPop>
     some stuff
</div>
Any help would be greatly appreciated - thanks.
Received on Mon May 1 03:41:31 2006