View Full Version : Please help me!

07-08-2011, 07:14 PM
<script type="text/javascript">
function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
var count = 2;
function validate() {
var un = document.myform.username.value;
var pw = document.myform.pword.value;
var valid = false;

var unArray = ["Username's go here","and more","and more"];
var pwArray = ["Password go here","and more","and more"];

for (var i=0; i <unArray.length; i++) {
if ((un == unArray[i]) && (pw == pwArray[i])) {
valid = true;

if (valid) {
alert ("Login was successful");
window.location = "loggedin/new tab.html";
return false;

var t = " tries";
if (count == 1) {t = " try"}

if (count >= 1) {
alert ("Invalid username and/or password. You have " + count + t + " left.");
document.myform.username.value = "";
document.myform.pword.value = "";
setTimeout("document.myform.username.focus()", 25);
setTimeout("document.myform.username.select()", 25);
count --;

else {
alert ("Still incorrect! You have no more tries left!");
document.myform.username.value = "No more tries allowed!";
document.myform.pword.value = "";
document.myform.username.disabled = true;
document.myform.pword.disabled = true;
return false;


<div id="apDiv1">
<form name = "myform">
<input type="text" name="username" />
<input type="password" name="pword" />
<input type="button" value="Login" name="Submit" onclick= "validate()" />
OK here is the thing, this script it java script and therefore does not have a reg form and needs the user and pass info added in here

var unArray = ["Username's go here","and more","and more"];
var pwArray = ["Password go here","and more","and more"];
It all works but what I want is to have the ability to have a reg form because when I made this I did not need one but know I do, How can I do this but still in java script!

07-09-2011, 07:04 AM
You sure you wanna do reg in javascript? Seems like someone would only have to switch it off and bypass your security. Also easier to hack as it is client rather than server-side.