[Javascript] cross browser dhtml - text replacement
Matt Warden
mwarden at gmail.com
Sat Sep 4 18:46:24 CDT 2004
On Sat, 04 Sep 2004 15:42:11 -0700, Hassan Schroeder
<hassan at webtuitive.com> wrote:
> Do you have the Microsoft Script Debugger installed?
No. I'm on Linux.
> Because it's
> halting on this line:
>
> secs = (osec.innerHTML)-0;
>
> :: proving that even IE, in its secret heart of hearts, knows that
> innerHTML is the TOOL OF SATAN :-)
I, too, was disturbed by this property. However, in what I read, it
was suggested as the most cross-platform method of accessing and
writing to the value of a node in the DOM.
> secs = parseInt(osec.firstChild.nodeValue);
> mins = parseInt(omin.firstChild.nodeValue);
> hrs = parseInt(ohrs.firstChild.nodeValue);
> days = parseInt(oday.firstChild.nodeValue);
> ...
>
> I'd fix the setValue() to not use innerHTML, too, but that's me. And
> it works on Safari, but not IE5.2/Mac. Sigh. Big surprise. I'll try
> to take a look at that later but I've gotta run do something else now.
While I don't give much of a hoot about IE5Mac, I would want to know
how this performs across platforms.
This little page seems to prove it works fine in Moz (as that's what I'm using):
http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/innerHTMLvsNodeValue.html
I like the looks of this method much more than .innerHTML, as long as
it does its job on a decent number of browsers. From what I can google
up, it looks like this is the case. Any confirmation of contradiction
of this would be appreciated.
Thanks so much, list!
--
Matt Warden
Miami University
Oxford, OH
http://mattwarden.com
This email proudly and graciously contributes to entropy.
More information about the Javascript
mailing list