john945
10-28-2011, 10:57 AM
hi im using a encrypted password script, im new to javascript, ive set four users, it works fine and forwards correctly, however on all but one password teven though the password works and forwards to a url the alert box appears, i cant work out why!.
also a simple one i want the submit button to be horizontally inline with the input box.
The passwords are:
john
james
tim
phil
The script ive used is below, many thanks.
<script>
//Encrypted Password script- By Rob Heslop
//Script featured on Dynamic Drive
//Visit http://www.dynamicdrive.com
function submitentry(){
password = document.password1.password2.value.toLowerCase()
passcode = 1
for(i = 0; i < password.length; i++) {
passcode *= password.charCodeAt(i);
}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(passcode==134603040)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location="http://www.google.com"}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(passcode==13017371870)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location="http://www.yahoo.com"}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(passcode==132088320)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location="http://www.ebay.com"}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(passcode==1327620)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location="http://www.hotmail.com"}
else{
alert("EITHER: Passcode incorrect.")}
}
</script>
<form name="password1">
<input type="password" name="password2" size="15">
<input type="button" value="Submit" onClick="submitentry()">
</form>
also a simple one i want the submit button to be horizontally inline with the input box.
The passwords are:
john
james
tim
phil
The script ive used is below, many thanks.
<script>
//Encrypted Password script- By Rob Heslop
//Script featured on Dynamic Drive
//Visit http://www.dynamicdrive.com
function submitentry(){
password = document.password1.password2.value.toLowerCase()
passcode = 1
for(i = 0; i < password.length; i++) {
passcode *= password.charCodeAt(i);
}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(passcode==134603040)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location="http://www.google.com"}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(passcode==13017371870)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location="http://www.yahoo.com"}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(passcode==132088320)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location="http://www.ebay.com"}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(passcode==1327620)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location="http://www.hotmail.com"}
else{
alert("EITHER: Passcode incorrect.")}
}
</script>
<form name="password1">
<input type="password" name="password2" size="15">
<input type="button" value="Submit" onClick="submitentry()">
</form>