View Full Version : simple password script fails in IE7 ?

03-18-2007, 03:54 PM
With zero Javascript experience, I long ago found a simple password script to provide very minimal access control to some web pages I maintain. Now that I've upgraded to IE7, I find the script does not work, or I don't yet know how to set IE7 to allow it to work. What I've been using has the advantage of not including the password in the script, but the disadvantage that everyone (members of a local homeowners' association) has the same "password"

<!-- Begin
var password = ''
password=prompt('Please enter your password:','');
if (password != null) {
location.href= password + ".html";
// End -->

Right now, when the script runs, IE7's information bar says a scripted window is asking for information, but when I allow that window, box to enter the "password" does not appear. If anyone can help me fix the script or figure out how IE7 needs to be set, that would be great.
Phil Wallas

03-18-2007, 04:34 PM
Well Phil I do not know exactly what you want but the below code will have a box requiring you to input the password test and if you do type in test in the box it will say in an alert COOL -

<input type="password" id="passbox"> <input type="button" onclick="passcheck()" value="Submit">
function passcheck() {
if (document.getElementById('passbox').value=="test") {alert("COOL")}

I have tested this in IE7 and it does work... If it does not work on your side you probably have disabled javascript or something...

Hope this helps :)