[Javascript] cross browser dhtml - text replacement
Paul Novitski
paul at novitskisoftware.com
Sat Sep 4 00:58:18 CDT 2004
At 02:27 PM 9/3/2004, Matt Warden wrote:
> if (document.getElementById)
> {
> osec = document.getElementById('secs');
> omin = document.getElementById('mins');
> ohrs = document.getElementById('hrs');
> oday = document.getElementById('days');
> }
> else if (document.all)
> {
> osec = document.all['secs'];
> omin = document.all['mins'];
> ohrs = document.all['hrs'];
> oday = document.all['days'];
> }
> else if (document.layers)
> {
> osec = document.layers['secs'];
> omin = document.layers['mins'];
> ohrs = document.layers['hrs'];
> oday = document.layers['days'];
> }
...
>Anything jump out at you as incorrect?
>
>I also get a "osec has no properties" error in the JS console of
>firefox, but it seems to have no negative effects on the script.
Just to cover my bets, I would end the if-test chain with
else return;
so you don't try to manipulate the four page elements if the browser can't
find them. That sounds like what's happening, based on the error you're
getting, although I'm not sure why. That's all my bleary eyes can see as a
problem tonight.
Paul
More information about the Javascript
mailing list