[thelist] DIV, innerHTML, and Mozilla Compatibility

Nebula Nebula at Planet-Nebula.com
Sat Feb 15 10:53:01 CST 2003


Hello.  I have recently been working on coding some JavaScript that
changes the contents of DIV tags.  I got it completely working fine in
Internet Explorer (I use document.all.*divID*.innerHTML to change it in
IE).

Now I have recently began using Mozilla, and I really like it.  But,
when I loaded my Jscript into Mozilla, it just choked on it, and did
nothing.  The error from Mozilla's JavaScript console is as follows:

----------
Error: document.all has no properties
Source File: http://localhost/download.js
Line: 26
----------

My line 24-28 is just this code: (I'm including these other lines so you
may see it as a function)

----------
function setDivText(divName, divValue)
{
	eval('document.all.' + divName + '.innerHTML = "' + divValue +
'";');
	return true;
}
----------

I'm guessing Mozilla uses a different way to modify the contents of
these DIV tags.  Any help would be greatly appreciated.  As my first
post here, I hope I've done everything right ;)





More information about the thelist mailing list