Hi all
I’m no programmer, but I need some simple password protection for one of my web pages. I copied the code below from a ‘javascript site’, but it does not work correctly.
Whether the correct p/word is typed in or not I am directed to my [url]http://********.com/Diary.htm[/url] page, wheras I only want to be directed there if the p/word is correct. Back to homepage if not etc.
Could someone please take a look at the code and point me in the right direction, thanks.
Sawsmith
<html>
<head>
<meta http-equiv=”Content-Type”
content=”text/html; charset=iso-8859-1″>
<meta name=”GENERATOR” content=”Microsoft FrontPage 4.0″>
<title>rer</title>
<script>
//we will first ask the user if he wold like to countinue into this restricted area
var p=confirm(“This site is password protected. Do you still want to enter?”)
if(p){
var ans=”learner”
var pass=prompt(“What is the password?”)
if(pass!==ans)
{
alert(“Never mind. You will now be transfered back to our website”);
window.location=”http://********.com/”}
else{alert(“Your in”);}
window.location=”http://
</script>
</head>
<body bgcolor=”#FFFFFF”>
</body>
</html>