Jump to content


Simple Javascripe


  • Please log in to reply
2 replies to this topic

#1 _*-[DarkLeo02]-_*

_*-[DarkLeo02]-_*
  • Guests

Posted 29 August 2004 - 10:32 PM

Hey, I'm looking for an simple Password promt in Javascript. Ok, I want it so that when the user clicks on the button (Button, not link) an aleart comes up and ask "Please Enter You Password" type thing. So the password is...sushi and when the user types in the password, if right, it just takes them to the page, and if wrong a aleart comes up saying "Access Denied - Password Incorrect". I know they can get the pass or page easily by using the "View Source" But meh. Help :)

#2 _*Jay_*

_*Jay_*
  • Guests

Posted 30 August 2004 - 06:02 AM

very ghey way of checking a password, ALWAYS keep your password out of the visible source code of the page. By that javascript method all the person needs is the address of the page to get in. So heres your validating form stuff:

For your form, add onSubmit="validate();" like so:
<form name="form" method="POST" action="form.php" onSubmit="validate();">

This will call the function "validate" when the user submits the form.

Now, enter this javascript in the head tag of the page, or somewhere above the form itself

<script type="text/javascript">
if (form.password.value=='') {
     alert('Please enter your password and try again.');
     event.returnValue=false;
}
</script>

Make sure you change "password" in this javascript to whatever the field name is, and "form" to whatever the form name is.

#3 _*-[DarkLeo02]-_*

_*-[DarkLeo02]-_*
  • Guests

Posted 30 August 2004 - 12:03 PM

Ok, I get nothing though o.o <--Newb at Java, I'm only good a perl




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users