CODE
function formsubmit(){
var correct = document.getElementById('un').src = "http://www.gibboes.com/tristan/images/correct.GIF";
var incorrect = document.getElementById('un').src = "http://gibboes.com/tristan/images/incorrect.GIF";
var blank = document.getElementById('un').src = "http://gibboes.com/tristan/images/blank.GIF";
var x=document.getElementById('signup');
var username = document.getElementById("username").value;
var ui = username.length;
var password = x.password.value;
var pi = password.length;
var conpassword = x.confirmedpass.value;
var cpi = conpassword.length;
var email = x.email.value;
if (ui > 6 && ui < 12){
correct;
}
else{
incorrect;
}
if (pi > 6 && pi < 20){
}
else{
}
if (conpassword == password){
}
else{
}
alert(username);
}code]
CODE
<?php
include("connect.php");
echo("<forms id='signup' action='register.php'>
Username:<input type='text' name='username'><img id='un' width='10' height='10' /><br/>
Password:<input type='password' name='password'><br/>
Confirm Password:<input type='password' name='confirmedpass'><br/>
Email:<input type='text' name='email'><br/>
Confirm Email:<input type='text' name='confirmemail'><br/>
<input type='submit' name='signup' value='By clicking accept you agree to the terms and conditions' onclick='formsubmit();'>
</forms>");
?>
Now im trying to change the image next to the username textbox, the code im using now works within reason.
It changes the image, but it always changes the image to correct.GIF even when it shouldnt
Also the alert box doesnt appear
What am i doing wrong here?
Thanks in advance
This post has been edited by dreadfear: 19 Jun, 2009 - 06:26 PM