 | 
September 4th, 2008, 07:52 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| | javascript is not working in firefox
Hi,
The below javascript is not working in the firefox, Please help me.. - <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; September 4th, 2008 at 06:06 PM.
Reason: Added [code] tags
| 
September 4th, 2008, 07:54 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| | 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
| 
September 4th, 2008, 08:51 AM
|  | Moderator | | Join Date: Aug 2007 Location: Germany Age: 21
Posts: 2,166
| |
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: - <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>
(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
| 
September 4th, 2008, 10:58 AM
| | Newbie | | Join Date: Jan 2007
Posts: 28
| |
What error message u r getting?
U can see the error message under Tools -->Error Console
-Hussain
| 
September 4th, 2008, 11:56 AM
| | Newbie | | Join Date: Sep 2008
Posts: 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.
| 
September 4th, 2008, 12:15 PM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| | 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.
| 
September 4th, 2008, 12:30 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,964
| |
Show the corresponding HTML code.
| 
September 4th, 2008, 12:53 PM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| | 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
| 
September 4th, 2008, 01:13 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,964
| |
Is your form named "login"?
| 
September 4th, 2008, 01:16 PM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| | Quote: |
Originally Posted by acoder Is your form named "login"? | yes..
<form name="login" method="post" id="aspnetForm">
| 
September 4th, 2008, 01:19 PM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| | Quote: |
Originally Posted by acoder Is your form named "login"? | yes...
<form name="login" method="post">
| 
September 4th, 2008, 01:27 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,964
| |
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.
| 
September 4th, 2008, 02:01 PM
| | Newbie | | Join Date: Sep 2008
Posts: 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.
| 
September 4th, 2008, 02:28 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,964
| |
From a cursory look, the JavaScript code seems OK.
The HTML for the link could be changed to this: - <a href="#" onclick="Login(); return false;">LOGIN</a>
or better still use a button: - <input type="button" onclick="Login()" value="LOGIN">
| 
September 4th, 2008, 07:09 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,964
| |
Threads merged.
Moderator.
| 
September 5th, 2008, 05:47 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| | 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.
| 
September 5th, 2008, 11:37 AM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,964
| |
You're welcome. Glad to help.
|  | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 205,248 network members.
|