[Javascript] cross browser dhtml - text replacement
Hassan Schroeder
hassan at webtuitive.com
Sat Sep 4 17:42:11 CDT 2004
Matt Warden wrote:
>>Do you have the relevant parts in try/catch blocks?
>
> No, I'm not. I use them in Java, but I was unaware they were available
> in Javascript.
Yes, and it's a nice addition to your debugging repertoire.
> http://mwarden.f2o.org/countdown_test.php
>
> This one does not seem to exhibit the "osec has no properties" error.
> However, it still does not work in IE/Win (not sure about IE/Mac).
Do you have the Microsoft Script Debugger installed? 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 :-)
OK, just ignore that; here's the fix:
function decrement()
{
var secs = 0;
var mins = 0;
var hrs = 0;
var days = 0;
// get thee behind me, innerHTML! :-) secs = (osec.innerHTML)-0;
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.
HTH!
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
More information about the Javascript
mailing list