Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: JavaScript
Expertise: Intermediate
Mar 5, 2007



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Javascript Errors in Firefox

Because browsers other than IE don't create global variables for every part of the page/DOM, you need to qualify references to the form and its elements in non-IE browsers. You can do this either by creating a form reference and passing that to methods, or by using an absolute reference to the document.forms collection in your code. For example:

// the code below works fine in IE.
<SCRIPT language="javascript">
function OnLoad()
//Works fine in IE and not in Firefox
frmName.SearchButton.disabled = true

//Replace the above line with the below one

//Works fine in both IE and Firefox
document.frmName.SearchButton.disabled = true 
<BODY onLoad = "onLoad()">
<form name="frmName">
<input id="SearchButton" name="SearchButton" type="button">
Balasubramanian Krishnaswamy
Thanks for your registration, follow us on our social networks to keep up-to-date