java script code not working with firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CoolForU
    New Member
    • Jun 2007
    • 15

    java script code not working with firefox

    this is my code and i call this code from code behinde file on page load
    like this
    useragree.Attri butes.Add("oncl ick", "CheckSelection ();")

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

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




    Code:
    <script language="javascript" type="text/jscript">
      function CheckSelection()
       {
            var chk1 = document.getElementById("useragree");
            var button =document.getElementById("signup");
            if (chk1.checked == true)
            { 
             button.disabled=false;
            }
            else
            {
            button.disabled=true;
            }
       }
    </script>
    Last edited by acoder; Oct 23 '08, 10:47 AM. Reason: Added [code] tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

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

    Comment

    • CoolForU
      New Member
      • Jun 2007
      • 15

      #3
      Originally posted by acoder
      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.:)

      Comment

      • CoolForU
        New Member
        • Jun 2007
        • 15

        #4
        this code also not working with fire fox can u plz help me.


        [CODE=javascript]<script language="javas cript" type="text/javascript">

        function CheckSelection( )
        {

        var txt =document.getEl ementById("txtn ewemail")
        var rd =document.getEl ementById("rdYe s")
        if (rd.checked==tr ue)
        {
        document.getEle mentById("divtx t").style.visib ility = "visible";
        document.getEle mentById("divtx t").style.displ ay = "block";
        }
        else
        {
        document.getEle mentById("divtx t").style.visib ility = "hidden";
        document.getEle mentById("divtx t").style.displ ay = "none";
        }
        }

        [/CODE]

        i call function like this

        [HTML]<tr>
        <td class="contentT ext" colspan="2">
        <b>Do you want to earn commission selling your home?</b>
        <input id="rdyes" onclick="CheckS election()" type="radio" value="1" name="rd" runat="server" />Yes
        <input id="rdno" onclick="CheckS election()" type="radio" value="0" name="rd" runat="server" />No
        </td>
        </tr>[/HTML]
        Last edited by acoder; Jul 6 '07, 09:01 AM. Reason: Code in tags

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #5
          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

          Comment

          • CoolForU
            New Member
            • Jun 2007
            • 15

            #6
            Originally posted by gits
            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 ..

            Comment

            Working...