javascript is not working in firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srinathpandit
    New Member
    • Sep 2008
    • 14

    javascript is not working in firefox

    Hi,

    The below javascript is not working in the firefox, Please help me..

    Code:
    <script>
    function Login(){
    var done=0;
    var username=document.login.username.value;
    username=username.toLowerCase();
    var password=document.login.password.value;
    password=password.toLowerCase();
    if (username=="adventure" && password=="adventure") { window.location="myaccount/Redeem_Game_Card.html"; done=1; }
    if (done==0) {
    document.getElementById("error_msg").style.display = "block";
     }
    }
    </SCRIPT>
    Last edited by acoder; Sep 4 '08, 05:06 PM. Reason: Added [code] tags
  • srinathpandit
    New Member
    • Sep 2008
    • 14

    #2
    javascript is not working in firefox

    Hi, The below javascript is not working in the firefox. Please help me..

    [HTML]<script>
    function Login(){
    var done=0;
    var username=docume nt.login.userna me.value;
    username=userna me.toLowerCase( );
    var password=docume nt.login.passwo rd.value;
    password=passwo rd.toLowerCase( );
    if (username=="adv enture" && password=="adve nture") { window.location ="myaccount/Redeem_Game_Car d.html"; done=1; }
    if (done==0) {
    document.getEle mentById("error _msg").style.di splay = "block";
    }
    }
    </SCRIPT>


    <a href="#" onClick="javasc ript:Login()">L OGIN</a>[/HTML]
    Last edited by gits; Sep 4 '08, 10:39 AM. Reason: added code tags

    Comment

    • Nepomuk
      Recognized Expert Specialist
      • Aug 2007
      • 3111

      #3
      Hi srinathpandit! Welcome to bytes.com!

      It's great to have you here!

      When you post, please always keep to the Posting Guidelines and when you post code, please post it in [code] ... [/code] tags. Just look at how much nicer your code would look with them: [code=javascript]<script>
      function Login(){
      var done=0;
      var username=docume nt.login.userna me.value;
      username=userna me.toLowerCase( );
      var password=docume nt.login.passwo rd.value;
      password=passwo rd.toLowerCase( );
      if (username=="adv enture" && password=="adve nture") {
      window.location ="myaccount/Redeem_Game_Car d.html"; done=1; }
      if (done==0) {
      document.getEle mentById("error _msg").style.di splay = "block";
      }
      }
      </SCRIPT>


      <a href="#" onClick="javasc ript:Login()">L OGIN</a>[/code](although I did indent it manually)

      As I've seen, you've also posted your question in the Javascript / DHTML / Ajax Forum - which is the right place for it. This isn't. So in future, please post your questions only in the relevant forum.

      Otherwise, I'll just wish you the best and hope you enjoy being part of bytes.com!

      Greetings,
      Nepomuk

      Comment

      • hussain123
        New Member
        • Jan 2007
        • 28

        #4
        What error message u r getting?
        U can see the error message under Tools -->Error Console

        -Hussain

        Comment

        • srinathpandit
          New Member
          • Sep 2008
          • 14

          #5
          Hi,

          Thanks for reply.

          I am not getting any error message, But script is working in IE but not in firefox.
          The requirement is, On giving user ID and Password, onclick on submit button,
          the page should go to the Redeem_Game_Car d.html.

          This is not working in firfox.

          I checked the error Console, There is no script errors on it on some CSS issues are there.

          Comment

          • srinathpandit
            New Member
            • Sep 2008
            • 14

            #6
            Originally posted by hussain123
            What error message u r getting?
            U can see the error message under Tools -->Error Console

            -Hussain
            Hi,

            Thanks for reply.

            I am not getting any error message, But script is working in IE but not in firefox.
            The requirement is, On giving user ID and Password, onclick on submit button,
            the page should go to the Redeem_Game_Car d.html.

            This is not working in firfox.

            I checked the error Console, There is no script errors on it, only some CSS issues are there.

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Show the corresponding HTML code.

              Comment

              • srinathpandit
                New Member
                • Sep 2008
                • 14

                #8
                Originally posted by acoder
                Show the corresponding HTML code.

                Hi,

                The below code is HTML code for login page,

                ----------------------------------------------------------------------------
                [HTML] <p class="input_ti tle">
                Email Address:<br />
                <input name="username" type="text" class="input_bo x" />
                </p>
                <p class="input_ti tle">
                Password:<br />
                <input name="password" type="password" class="input_bo x" />
                </p>

                <p class="checkbox "><input type="checkbox" />Remember me</p>
                <span class="privacy_ link"><a href="/customercare/privacypolicy.a spx">Privacy Policy</a></span>

                <div class="red_btn" >
                <a href="#" onClick="javasc ript:Login()">L OGIN</a>
                <div style="clear:bo th;"></div>
                </div>[/HTML]
                Last edited by acoder; Sep 4 '08, 11:59 AM. Reason: Added [code] tags

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  Is your form named "login"?

                  Comment

                  • srinathpandit
                    New Member
                    • Sep 2008
                    • 14

                    #10
                    Originally posted by acoder
                    Is your form named "login"?
                    yes..

                    <form name="login" method="post" id="aspnetForm" >

                    Comment

                    • srinathpandit
                      New Member
                      • Sep 2008
                      • 14

                      #11
                      Originally posted by acoder
                      Is your form named "login"?
                      yes...

                      <form name="login" method="post">

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        When you say it's not working, what happens? Does it just stay on the page even if you input the correct username/password?

                        PS. you shouldn't have login code on the client-side.

                        Comment

                        • srinathpandit
                          New Member
                          • Sep 2008
                          • 14

                          #13
                          yes..
                          in IE it will go to Redeem_Game_Car d.html page, but in Firefox it will saty in that page only and it wont show any error also, Is there any error in the code? i am confused...

                          Is there any other way or code for this type of requirement.

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            From a cursory look, the JavaScript code seems OK.

                            The HTML for the link could be changed to this:
                            [code=html]<a href="#" onclick="Login( ); return false;">LOGIN</a>[/code]or better still use a button:
                            [code=html]<input type="button" onclick="Login( )" value="LOGIN">[/code]

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #15
                              Threads merged.

                              Moderator.

                              Comment

                              Working...