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

javascript is not working in firefox

P: 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>
Sep 4 '08 #1
Share this Question
Share on Google+
16 Replies


P: 14
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]
Sep 4 '08 #2

Nepomuk
Expert 2.5K+
P: 3,112
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
Sep 4 '08 #3

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

-Hussain
Sep 4 '08 #4

P: 14
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.
Sep 4 '08 #5

P: 14
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.
Sep 4 '08 #6

acoder
Expert Mod 15k+
P: 16,027
Show the corresponding HTML code.
Sep 4 '08 #7

P: 14
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]
Sep 4 '08 #8

acoder
Expert Mod 15k+
P: 16,027
Is your form named "login"?
Sep 4 '08 #9

P: 14
Is your form named "login"?
yes..

<form name="login" method="post" id="aspnetForm">
Sep 4 '08 #10

P: 14
Is your form named "login"?
yes...

<form name="login" method="post">
Sep 4 '08 #11

acoder
Expert Mod 15k+
P: 16,027
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.
Sep 4 '08 #12

P: 14
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.
Sep 4 '08 #13

acoder
Expert Mod 15k+
P: 16,027
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">
Sep 4 '08 #14

acoder
Expert Mod 15k+
P: 16,027
Threads merged.

Moderator.
Sep 4 '08 #15

P: 14
Threads merged.

Moderator.

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

Its working in both IE and Firefox.
Sep 5 '08 #16

acoder
Expert Mod 15k+
P: 16,027
You're welcome. Glad to help.
Sep 5 '08 #17

Post your reply

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