Click to See Complete Forum and Search --> : Help with username script


Jupac
07-22-2003, 08:43 PM
Can some one help me with this script it is used to check if the username is taken or not.

<html>
<head>
<script>
function MsgBox(e) {alert(e)}

function cuname(){
var check="0"

if (form1.text1.value != "username1"){check="1";}
if (form1.text1.value != "username2"){check="1";}

if (check=="0") {MsgBox(form1.text1.value) is not taken is ok to use as username}
if (check=="1") {MsgBox(form1.text1.value) is taken try a diffrent Username}

}


</script>
</head>


<body>

<form onsubmit="cuname()" name="form1">
<input Name="text1" value="">
<input type="submit" name="submit" value="try">
</form>

</body>
</html>

Charles
07-22-2003, 10:00 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
<!--
user = {fee:1, fie:1, foe:1, fum:1}
// -->
</script>
<form action="">
<div>
<label><input type="text" onchange = "if (user[this.value]) {alert ('That name is taken.'); this.value = ''; this.focus()}">User Name</label>
</div>
</form>

Jupac
07-22-2003, 11:37 PM
Thanx for replying,but it dosn't work?

Charles
07-23-2003, 05:21 AM
Yes it does. Can you post a URL to your cversion?