Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 4th, 2008, 07:52 AM
Newbie
 
Join Date: Sep 2008
Posts: 14
Default 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; September 4th, 2008 at 06:06 PM. Reason: Added [code] tags
Reply
  #2  
Old September 4th, 2008, 07:54 AM
Newbie
 
Join Date: Sep 2008
Posts: 14
Default 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
Reply
  #3  
Old September 4th, 2008, 08:51 AM
Nepomuk's Avatar
Moderator
 
Join Date: Aug 2007
Location: Germany
Age: 21
Posts: 1,817
Default

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=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>[/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
Reply
  #4  
Old September 4th, 2008, 10:58 AM
Newbie
 
Join Date: Jan 2007
Posts: 28
Default

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

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

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

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.
Reply
  #7  
Old September 4th, 2008, 12:30 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,593
Default

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

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
Reply
  #9  
Old September 4th, 2008, 01:13 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,593
Default

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

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

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

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

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

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

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.
Reply
  #14  
Old September 4th, 2008, 02:28 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,593
Default

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]
Reply
  #15  
Old September 4th, 2008, 07:09 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,593
Default

Threads merged.

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

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.
Reply
  #17  
Old September 5th, 2008, 11:37 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,593
Default

You're welcome. Glad to help.
Reply
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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 network members.
Post your question now . . .
It's fast and it's free

Popular Articles