In a web application, writing javascript is a common work, and I have tried to create cross-browser code.
If I try my best to make it work in Firefox, then it does not work in IE.
So I wonder if there are any rules or experiences from you guys to tell me how to write cross-browser code?
UPDATE:
Sorry I forget to make it sure that we can not use jquery in my current application since we are usng prototype1.4(which is to difficult to use than jquery),so most time we use the native javascript.
The vast majority of problems will go away if you:
Most of the rest will go away if you use a library that abstracts away the differences. There are plenty of small specialized ones as well as kitchen sink options such as YUI and jQuery.