I can’t believe I am writing this, or that I am having to code this way. It seems a major client of ours refuses to use IE. So out major webapp has to be compliant with Netscape and Mozilla Firefox. Man does that make for problems. Although the DOM should be the same, it seems MS has of course, added a bunch of custom stuff that works in IE. Yeah .NET is supposed to determine the browser type and output the proper html. This does work, but it’s not the case when it comes to using javascript! It seems IE and Netscape view the DOM differently when it comes to executing javascript code on the client. for example: I had this simple javascript to do a calculation on the client page:
function DoPercentCalc()
{
var ValueControl;
var DivisorControl;
var DestinationControl;
ValueControl = document.getElementById('txtboxHomeless');
DivisorControl = document.getElementById('lblTotalUnits');
DestinationControl = document.getElementById('lblpercent');
DestinationControl.innerText = (setDecimalString(2,(parseFloat(ValueControl.value) / parseFloat(DivisorControl.innerText)*100)))+ ' %';
}
while this works fine in IE, it doesn't work in Firefox.... I had to change the script to use DestinationControl.innerHTML, instead of innerText. This is fine as IE sees this property also, but it crashes miserably if any tags are used in the html, ie, bold, italics, whatever, anything but a number and I'm screwed.
Why are we here again? I hate javascript! I have no choice but to make the app work in Firefox, but at least I can vent about it!
Gavin