www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need help fixing a javascript code asap. Please

  1. #1
    Join Date
    Sep 2010
    Posts
    1

    Question Need help fixing a javascript code asap. Please

    I am looking for anyone who may be able to help me fix up this code i got off of "javascript" kit. I am fairly new to Javascript and am still in the learning process but am hoping someone can help me out.

    Its to password protect a webpage.

    I can't figure out how to change the text color on the code to change the text from "black" to "white"

    I am also wondering how I would get the page that loads after the username and password have been entered correctly to be at the top.

    " load('success.htm');"

    I am replacing 'success.htm' with a website url and need it to load at the top. The way it is right now is the website loads 10 lines or so down the page because the script above it is in its place.

    Any help would be very much appreciated.

    Here is the code:

    <form>
    <p>ENTER USER NAME :
    <input type="text" name="text2">
    </p>
    <p> ENTER PASSWORD :
    <input type="password" name="text1">
    <input type="button" value="Check In" name="Submit" onclick=javascript:validate(text2.value,"free",text1.value,"javascript") >
    </p>

    </form>
    <script language = "javascript">

    /*
    Script by Anubhav Misra (anubhav_misra@hotmail.com)
    Submitted to JavaScript Kit (http://javascriptkit.com)
    For this and 400+ free scripts, visit http://javascriptkit.com
    */

    function validate(text1,text2,text3,text4)
    {
    if (text1==text2 && text3==text4)
    load('success.htm');
    else
    {
    load('failure.htm');
    }
    }
    function load(url)
    {
    location.href=url;
    }
    </script>

    <p align="center"><font face="arial" size="-2">This free script provided by <a href="http://javascriptkit.com">JavaScript Kit</a></font></p>


    Thank you very much,

    Steve

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    I can't figure out how to change the text color on the code to change the text from "black" to "white"
    Code:
    <style type="text/css">
    input {
    color:white;
    background:black;
    }
    </style>
    I am also wondering how I would get the page that loads after the username and password have been entered correctly to be at the top.
    At the top of what?

    The script is not secure, anyone can easily see the codes and location.
    This would be better: http://www.elated.com/articles/passw...with-htaccess/

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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