dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


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.
<HTML>
<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 
} 
</SCRIPT>
<BODY onLoad = "onLoad()">
<form name="frmName">
<input id="SearchButton" name="SearchButton" type="button">
</BODY>
</HTML>
Balasubramanian Krishnaswamy
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date