www.webdeveloper.com
Results 1 to 5 of 5

Thread: jspass

  1. #1
    Join Date
    Oct 2003
    Posts
    8

    jspass

    I have been using this simple, yet elegant, script for many years and it has suddenly stopped functioning! Does anyone understand why? It is for simple protection of multiple pages from casual users.

    <script language="JavaScript" TYPE="text/javascript">
    <!--
    function SubmitPassword(frm)
    {
    //
    // Get the value entered into the text box
    //
    var password = frm.pw.value
    //
    //Convert it to lower case
    //
    password = password.toLowerCase()
    //
    //Add the .htm extension
    //
    var loc=password + ".htm"
    //
    // make sure the user entered something
    //
    if (password != "")
    {
    //
    // If so, send the browser there
    //
    opener.location.href=loc
    }
    //
    //Close this window
    //
    window.close()
    }
    // -->
    </script>

  2. #2
    Join Date
    Jul 2009
    Posts
    184
    Do you get any errors in your console(Chrome dev tools, or Firebug)?

  3. #3
    Join Date
    Oct 2003
    Posts
    8

    response to code

    This script should take the password, add .htm and send the user to that protected page. Instead, it is returning the user to the previous page from which they reached the jspass input page.

  4. #4
    Join Date
    Jul 2009
    Posts
    184
    Ok, then it sounds like the window.close() line is being triggered(presumably what brings the user to the "previous page" as you said).

    try putting this just inside your function and see what it displays:

    Code:
    alert(frm.pw.value);
    If nothing then you'll need to check that you are getting the value of the right form element. I can't check that as you have not supplied the relevant code.

  5. #5
    Join Date
    Oct 2003
    Posts
    8

    Jspass solution

    Turns out that for whatever reason, the script will only work now with .html extension rather than .htm. All fixed. Thanks for trying to assist.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles