Why is my Javascript working in IE and Safari but not Firefox?

I am creating this new site for my client and we have a ton of javascript functions. The code worked as planned when I tested the code with Internet Explorer and Safari. However when I tested it with Firefox (both the mac and windows), my scripts began to fail. How could this be? Just ten minutes ago it was working like a champ!
Here is a snipet code that was failing:

function Next()
{
nValue = formpost.txtHiddenPageCount.value;
nValue++;
formpost.txtHiddenPageCount.value = nValue;
formpost.submit();
}

Then it hit me. I needed to include the document object in front of each element! It’s good to see Firefox enforcing the proper use of the DOM. Next time, I will begin testing with Firefox instead of IE.

One can only hope that Microsoft will follow suit with IE 7. Internet Explorer has always been too foregiving with the way interpets HTML and javascript. Their HTML/Javascrript engine has also allowed us developers to be lazy and to get away with hacking HTML and javascipt. With Firefox and Apple’s Safari gaining market share, the days of designing your site to only work with IE is over!

2 comments ↓

#1 Haacked on 02.07.06 at 7:44 am

That’s pretty much my technique with any client technologies (Javascript, CSS, etc…) is to start with Firefox as a base and then add my hacks for IE and Macs afterwards.

#2 Niels on 02.07.06 at 5:40 pm

Yeah. Don’t even get me started on how IE implements CSS!

Leave a Comment