Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Thread Tools Display Modes
Old 07-08-2011, 07:14 PM   #1
drunkmafia's Avatar
Join Date: Jun 2011
Posts: 17
Default Please help me!

HTML Code:
<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
HTML Code:
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!

Last edited by drunkmafia; 07-08-2011 at 07:19 PM..
drunkmafia is offline   Reply With Quote
Old 07-09-2011, 07:04 AM   #2
Corrosive's Avatar
Join Date: Feb 2008
Location: Bristol, England
Posts: 7,103

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.
Corrosive is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 09:36 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com