• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JS works in IE but not in FF

 
Swathi Ram
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "not work" mean? Computer bursts into flames? Electricity arcs across keyboard?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
sirish veer
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit: thread hijack removed. sirish veer, please start a new topic for your own questions.]
[ February 06, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic