This script is a horrible idea. Anyone viewing the page's source code can get the password and then enter your adminspalace.htm page. Also, they could just look and see the name of the page and enter it directly into the browser's address bar to navigate to it without filling out the form.
Server side code should be used for this type of thing.
That said, this would do as you say you want:
Code:
<script type="text/javascript">
/* This Script allows people to enter by using a form that asks
for a Password or by viewing the page's source code */
function passwrd(form){
if(form.elements.pass.value === '16320606'){
location = 'adminspalace.htm';
} else {
alert('Invalid Password');
location = 'someother.htm';
}
return false;
}
</script>
<form action="#" name="login" onsubmit="return passwrd(this.form)">
<div>
<span class="style13">Password: </span>
<input name="pass" type="password" size="15">
<input type="submit" value="Login">
</div>
</form>
Bookmarks