Results 1 to 2 of 2

Thread: simple password script fails in IE7 ?

  1. #1
    Join Date
    Mar 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default simple password script fails in IE7 ?

    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"

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

    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.
    Thanks,
    Phil Wallas

  2. #2
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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 -

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

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •