cross browser javascripting

akohl's picture

They have: 117 posts

Joined: Feb 2001

Any recommendations for articles or reference tables which might help me to get my scripts to work in all browsers. Until now I have scripted for ie. So I need to know the parallel objects and properties for the other browsers.

Andy Kohlenberg
Jerusalem, Israel

They have: 3 posts

Joined: Dec 2001

is your site dynamic or standard html? If it's dynamic, php for example, you'd look for a browser detection code... if it's static html, you should use a javascript redirect script.

"If i tell you a duck can pull a truck, just shut up and hook the duck to the truck" -Jerome from Martin

detox's picture

They have: 571 posts

Joined: Feb 2001

If you have a specific development crossbrowser problem, then one of the best places to go is irt.org

otherwise there are plenty of great sites out there that cover a lot of crossbrowser javascript and html issues.

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi akohl,

Some crossBrowser tips:

1) use tags (You can access an element in IE without one, but the form element will never appear in Netscape without encircling form tags)

2) selection list syntax is: document.formname.selectname.options[document.formname.selectname.selectedIndex].value (or .text) --> do not use the IE shortcut.

3) close all tags that have closing tags (, , , etc. etc)

4) Netscape 4 does not recognize display='none'

5) Netscape 4 layers/divs must be positioned absolutely (not relatively) if you wish to manipulate them.

If interested: the vast majority (99%) of the script/tutoritals at my site are crossBrowser compatible.

Vinny

Where the world once stood
the blades of grass cut me still

akohl's picture

They have: 117 posts

Joined: Feb 2001

I'm using asp. So I can redirect to netscape browser javascripts. But I don't know how to write them!

I remember hearing or reading somewhere that the DOM in netscape is different. If so, a simple comparison chart or graph between the different doms would be helpful.

In the meantime I'll look at the sites mentioned here.

Regarding Vinny's post, I had a really wierd rendering in netscape 4. It was just a table layout with an centered with a div tag inside a table cell. The picture presented on top of (like a layer where you could see the lsyer underneath.) the text in a different table cell!

How might that happen?
Thanks!

Andy Kohlenberg
Jerusalem, Israel

detox's picture

They have: 571 posts

Joined: Feb 2001

from memory, webreference.com has quite a few reference charts, from DOM to CSS etc

Another good thing to do would be to go to netscape.com and download their javascript reference. As far as I can remember microsoft has a Jscript documentation download as well.

And of course the best way to learn crossbrowser javascript is a combination of trial and error and good support from others more knowledgeable. TWF is a great forum to post your problems, we will all try to answer the question as soon as possible.

cheers

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.