aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JS works in IE  but not in FF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JS works in IE  but not in FF" Watch "JS works in IE  but not in FF" New topic
Author

JS works in IE but not in FF

Swathi Ram
Greenhorn

Joined: Sep 18, 2007
Posts: 27
Can any one help .This works in IE but not in FF.
document.getElementById(fname) picks up null in firefox.

function facilityChange(fname) {
if(document.getElementById(fname).checked == true) {
document.forms[0].fName1.value = 'Yes';
document.forms[0].submit();
}
if(document.getElementById(fname).checked == false) {
document.forms[0].fName1.value = 'No';
document.forms[0].submit();
}
}
[ January 31, 2008: Message edited by: Swathi Ram ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and most people will just go elsewhere. Please read this for more information.

You can go back and change your post to add code tags by clicking the .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

What does "not work" mean? Computer bursts into flames? Electricity arcs across keyboard?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Swathi Ram:
Can any one help .This works in IE but not in FF.
document.getElementById(fname) picks up null in firefox.


My first guess when I hear this question is that your element has a name attribute but not an ID attribute. MSIE (incorrectly) will use the name element if there is no id present for document.getElementById.
[ January 31, 2008: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
sirish veer
Greenhorn

Joined: Feb 06, 2008
Posts: 3
[Edit: thread hijack removed. sirish veer, please start a new topic for your own questions.]
[ February 06, 2008: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JS works in IE but not in FF