Continued from page 1
if (isIE4){
return document.all[documentID];
}else if(isIE6){
return document.getElementById(documentID);
}else if (isNS4){
return document.layers[documentID];
}else if (isNS6){
return document.getElementById(documentID);
}
}
The above function comprimises by using
typical test defined earlier to identify our browser DOM, and returns
object identified by its ID / NAME pair. So whenever you need to do something to an object, this approach requires that you call
getDOMObeject () function. For example,
following will set
value attribute of a hypothetical text box to 'test value'.
getDOMObject('txtMyTextBoxID').value = "Test Value";
The value of this approach comes to
front in scripts where you need to access multiple objects in your document. For example:
getDOMObject('txtMyTextBoxID1').value = "Test Value 1";
getDOMObject('txtMyTextBoxID2').value = "Test Value 2";
getDOMObject('txtMyTextBoxID3').value = "Test Value 3";
getDOMObject('txtMyTextBoxID4').value = "Test Value 4";
getDOMObject('txtMyTextBoxID5').value = "Test Value 5";
getDOMObject('txtMyTextBoxID6').value = "Test Value 6";
Looks like a lot less work, doesn't it?

Riaan Pieterse is the CEO and founder of Kerberos Internet Services CC, South Africa. Having spent a number of years conducting various consulting assignments in the Far East, Middle East, Africa and Europe to businesses and governments alike, Riaan has a solid understanding of the business and technology issues in today's market. For more information visit www.kerberosdev.net or www.kerberosb2b.com