[thelist] How do I know if a piece of JS is DOM or browser specific?
Timothy J. Luoma
lists at tntluoma.com
Tue Oct 15 21:09:00 CDT 2002
Peter-Paul Koch wrote:
> This is not an exact comparision. Take forms, for instance. In the
> newest browsers you can access a form by
>
> document.getElementById('form_id')
>
> and your form validation script will work. However, this is not the
> best way to access forms. Simple form validation *can* work in
> Netscape 2, and therefore, in my opinion, *should* work in Netscape
> 2. This means that you have to use the old Level 0 DOM
>
> document.forms['form_name']
>
> In general you should use the Level 0 DOM (the one that Netscape
> standardized before W3C existed) whenever possible. This is the best
> way to program JavaScripts.
Ok, I can understand the rationale there. So if I used
document.forms['form_name']
you would expect it to not only work in DOM compliant browsers but also
"moldy oldies"?
> It needs to be able to redraw pages without reloading them.
> Understanding the Opera 7 pre-publicity correctly, it will support
> exactly this.
Such as being able to change background colors, etc? If so then that is
a problem we ran into with CSS as well (where :hover only worked on
links, and only for some things)
> Maybe it would be best for you to stick to the W3C DOM and the Level
> 0 (Netscape) DOM and forget about intermediate stuff like
> document.all and document.layers . Don't forget about Level 0,
> though. It's much simpler than the W3C DOM and not using Level 0
> where you could use it is bad coding practice, in my opinion.
ok... (... time passes as Tim hits Google up for 'dom 0')...
Hrm... lookee here:
http://www.xs4all.nl/~ppk/js/dom0.html
:-)
> The problem is that simple JS books aren't written for your situation
> but for people who want to learn JavaScript in a hurry to code sites
> for money, which means cross-browser compatibility goes before
> anything else.
Exactamundo
> I recommend the Glasshaus book, "Practical JavaScript for the Usable
> Web" by Wilton, Williams and Li. It strikes the right balance
> between theoretical and practical information.
and onto the wishlist she goes ;-)
Thanks
TjL
--
OperaBlog: Beyond30 http://tntluoma.com/beyond30
30 Days to becoming an Opera Lover http://www.tntluoma.com/switch
Opera Panels / Sidebars http://tntluoma.com/sidebars
More information about the thelist
mailing list