Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

case sensitivey password

Status
Not open for further replies.

zeero

Programmer
Aug 4, 2004
60
US
Hi all, I was wondering how I could make this js password prompt NOT case sensitive.

Code:
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--hide
var password=prompt('Enter password:','');
var mypass="fish";
if (password==mypass)
{
  window.location="continue.html";
}
else
{
 window.location="error.html";
}
//-->
</SCRIPT>
</HEAD>
<BODY>&nbsp;</BODY>
</HTML>

the way it is like that, it can only be entered in all lowercase, I want to have it not matter if it's upper or lower. Thanks.
 
Code:
if (password.toUpperCase() == mypass.toUpperCase())

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
Thanks chessbot, how do I implement that in the code?
 
Swap it with this line:
Code:
if (password==mypass)

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top