Connecting Tech Pros Worldwide Help | Site Map

javascript is not working in firefox

  #1  
Old September 4th, 2008, 07:52 AM
Newbie
 
Join Date: Sep 2008
Posts: 14
Hi,

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

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function Login(){
  3. var done=0;
  4. var username=document.login.username.value;
  5. username=username.toLowerCase();
  6. var password=document.login.password.value;
  7. password=password.toLowerCase();
  8. if (username=="adventure" && password=="adventure") { window.location="myaccount/Redeem_Game_Card.html"; done=1; }
  9. if (done==0) {
  10. document.getElementById("error_msg").style.display = "block";
  11.  }
  12. }
  13. </SCRIPT>

Last edited by acoder; September 4th, 2008 at 06:06 PM. Reason: Added [code] tags
  #2  
Old September 4th, 2008, 07:54 AM
Newbie
 
Join Date: Sep 2008
Posts: 14

re: 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=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>


<a href="#" onClick="javascript:Login()">LOGIN</a>[/HTML]

Last edited by gits; September 4th, 2008 at 11:39 AM. Reason: added code tags
  #3  
Old September 4th, 2008, 08:51 AM
Nepomuk's Avatar
Moderator
 
Join Date: Aug 2007
Location: Germany
Posts: 2,468

re: javascript is not working in firefox


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:
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function Login(){
  3.    var done=0;
  4.    var username=document.login.username.value;
  5.    username=username.toLowerCase();
  6.    var password=document.login.password.value;
  7.    password=password.toLowerCase();
  8.    if (username=="adventure" && password=="adventure") {
  9.       window.location="myaccount/Redeem_Game_Card.html"; done=1; }
  10.    if (done==0) {
  11.       document.getElementById("error_msg").style.display = "block";
  12.    }
  13. }
  14. </SCRIPT>
  15.  
  16.  
  17. <a href="#" onClick="javascript:Login()">LOGIN</a>
(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
  #4  
Old September 4th, 2008, 10:58 AM
Newbie
 
Join Date: Jan 2007
Posts: 28

re: javascript is not working in firefox


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

-Hussain
  #5  
Old September 4th, 2008, 11:56 AM
Newbie
 
Join Date: Sep 2008
Posts: 14

re: javascript is not working in firefox


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_Card.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.
  #6  
Old September 4th, 2008, 12:15 PM
Newbie
 
Join Date: Sep 2008
Posts: 14

re: javascript is not working in firefox


Quote:
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_Card.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.
  #7  
Old September 4th, 2008, 12:30 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,521
Provided Answers: 12

re: javascript is not working in firefox


Show the corresponding HTML code.
  #8  
Old September 4th, 2008, 12:53 PM
Newbie
 
Join Date: Sep 2008
Posts: 14

re: javascript is not working in firefox


Quote:
Originally Posted by acoder
Show the corresponding HTML code.

Hi,

The below code is HTML code for login page,

----------------------------------------------------------------------------
[HTML] <p class="input_title">
Email Address:<br />
<input name="username" type="text" class="input_box" />
</p>
<p class="input_title">
Password:<br />
<input name="password" type="password" class="input_box" />
</p>

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

<div class="red_btn">
<a href="#" onClick="javascript:Login()">LOGIN</a>
<div style="clear:both;"></div>
</div>[/HTML]

Last edited by acoder; September 4th, 2008 at 12:59 PM. Reason: Added [code] tags
  #9  
Old September 4th, 2008, 01:13 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,521
Provided Answers: 12

re: javascript is not working in firefox


Is your form named "login"?
  #10  
Old September 4th, 2008, 01:16 PM
Newbie
 
Join Date: Sep 2008
Posts: 14

re: javascript is not working in firefox


Quote:
Originally Posted by acoder
Is your form named "login"?
yes..

<form name="login" method="post" id="aspnetForm">
  #11  
Old September 4th, 2008, 01:19 PM
Newbie
 
Join Date: Sep 2008
Posts: 14

re: javascript is not working in firefox


Quote:
Originally Posted by acoder
Is your form named "login"?
yes...

<form name="login" method="post">
  #12  
Old September 4th, 2008, 01:27 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,521
Provided Answers: 12

re: javascript is not working in firefox


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.
  #13  
Old September 4th, 2008, 02:01 PM
Newbie
 
Join Date: Sep 2008
Posts: 14

re: javascript is not working in firefox


yes..
in IE it will go to Redeem_Game_Card.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.
  #14  
Old September 4th, 2008, 02:28 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,521
Provided Answers: 12

re: javascript is not working in firefox


From a cursory look, the JavaScript code seems OK.

The HTML for the link could be changed to this:
Expand|Select|Wrap|Line Numbers
  1. <a href="#" onclick="Login(); return false;">LOGIN</a>
or better still use a button:
Expand|Select|Wrap|Line Numbers
  1. <input type="button" onclick="Login()" value="LOGIN">
  #15  
Old September 4th, 2008, 07:09 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,521
Provided Answers: 12

re: javascript is not working in firefox


Threads merged.

Moderator.
  #16  
Old September 5th, 2008, 05:47 AM
Newbie
 
Join Date: Sep 2008
Posts: 14

re: javascript is not working in firefox


Quote:
Originally Posted by acoder
Threads merged.

Moderator.

Thank you so much, Its working (return false;). You r a genius........

Its working in both IE and Firefox.
  #17  
Old September 5th, 2008, 11:37 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,521
Provided Answers: 12

re: javascript is not working in firefox


You're welcome. Glad to help.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ajax is not working in firefox and opera benoypaul answers 8 September 30th, 2008 07:43 PM
my javascript is not working in FireFox kaleeswaran answers 3 May 7th, 2008 07:27 AM
Combo box code is Working in IE perfectly but it is not working in FireFox buss123 answers 33 October 24th, 2007 12:10 PM
onkeyup event is not working in firefox.. manojsharma answers 1 July 24th, 2007 01:02 PM