By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,978 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,978 IT Pros & Developers. It's quick & easy.

java script code not working with firefox

P: 15
this is my code and i call this code from code behinde file on page load
like this
useragree.Attributes.Add("onclick", "CheckSelection();")

this is working fine with IE but not working with fire fox.

in firefox i got error :
Error: CheckSelection is not defined




Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/jscript">
  2.   function CheckSelection()
  3.    {
  4.         var chk1 = document.getElementById("useragree");
  5.         var button =document.getElementById("signup");
  6.         if (chk1.checked == true)
  7.         { 
  8.          button.disabled=false;
  9.         }
  10.         else
  11.         {
  12.         button.disabled=true;
  13.         }
  14.    }
  15.  
</script>
Jul 5 '07 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
The script tag's type attribute should be "text/javascript", not "text/jscript". JScript only works in IE.
Jul 5 '07 #2

P: 15
The script tag's type attribute should be "text/javascript", not "text/jscript". JScript only works in IE.

Thanks
it's working.
again thank u very much.:)
Jul 6 '07 #3

P: 15
this code also not working with fire fox can u plz help me.


Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2.  
  3. function CheckSelection()
  4.     {
  5.  
  6.         var txt =document.getElementById("txtnewemail")
  7.         var rd =document.getElementById("rdYes")
  8.        if (rd.checked==true)
  9.     {
  10.         document.getElementById("divtxt").style.visibility = "visible";
  11.         document.getElementById("divtxt").style.display = "block";
  12.     } 
  13.     else
  14.     {
  15.         document.getElementById("divtxt").style.visibility = "hidden";
  16.         document.getElementById("divtxt").style.display = "none";
  17.     }
  18.     }
  19.  
  20.  
i call function like this

[HTML]<tr>
<td class="contentText" colspan="2">
<b>Do you want to earn commission selling your home?</b>
<input id="rdyes" onclick="CheckSelection()" type="radio" value="1" name="rd" runat="server" />Yes
<input id="rdno" onclick="CheckSelection()" type="radio" value="0" name="rd" runat="server" />No
</td>
</tr>[/HTML]
Jul 6 '07 #4

gits
Expert Mod 5K+
P: 5,351
hi ...

at a first look i see that you have a typo with id="rdyes" ... you try to getElementById('rdYes') ... but the ids are case sensitive ... getElementById will not find your element and var rd will be undefined ...

kind regards
Jul 6 '07 #5

P: 15
hi ...

at a first look i see that you have a typo with id="rdyes" ... you try to getElementById('rdYes') ... but the ids are case sensitive ... getElementById will not find your element and var rd will be undefined ...

kind regards

Thanks it's working ..
Jul 6 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.