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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alert for incorrect password

Status
Not open for further replies.

crjo

Programmer
Jul 3, 2001
15
US
Very simple non-critical password prompt where the password is equal to the page name (Stuff.htm):

<script language="javascript">
<!-- begin
function Enter() {
var location;
var password;
password=this.document.entryform.inputbox.value
location=password + ".htm"
fetch(location)
Stuff=window.close()
}
function fetch(location) {
var root;
if (opener.closed) {
root=window.open('','getStuff','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no');
root.location.href = location;
} else {
opener.location.href = location;
}
}
// end -->
</script>

It works fine except that if an incorrect password is entered it will look for a page name equal to the incorrect password. I would like to simply pop an alert ('Incorrect password') instead. Hope that made sense.
 
Where is your list of correct passwords? Since the pages reside on the server, you can use a custom 404 error page that will pop up the error message, then redirect back to the login page.

Lee
 

Unless you want to store your passwords on the page (not advisable), you will have to do a server-side check.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
This is one of the old Jasvascript password "tricks" where the page name is the password. To trap errors without using any server-side scripting, you have to use a custom 404 - Page Not Found error page.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top