It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

What's wrong with this script?

What's wrong with this script?

Postby jrolinson on Mon Mar 24, 2008 11:07 am

Trying to get some script working that simply gets user input, checks if that input string has already been used and either tells the user or continues. For now, the script has a fair few test window alerts, but I can't see why it's not working. Can anyone help?

<html>
<head>
<script language="JavaScript">
function MakeNewClient()
{
window.alert("test1");
NewClientName = window.prompt("Please enter client name","");
NameExists = false;
if ((NewClientName != null) && (NewClientName != ""))
{
for (count = 0; count < document.forms[0].AdminClient.length; count++)
{
If (document.forms[0].AdminClient.options[count].text == NewClientName)
{
NameExists = true;
}
window.alert(document.forms[0].AdminClient.options[count].text);
}
If (NameExists == true)
{
window.alert("That client name already exists. Please choose another.");
}
else
{
window.alert("TEMP continue with new client creation");
}
window.alert("test2");
}
window.alert("test3");
}
</script>
</head>
<body>
<form>
<P>
<Select Name="AdminClient">
<OPTION>Client 1
<OPTION>Client 2
<OPTION>Client 3
</SELECT></P>
<input name = btn type=button value="Some text" onClick="MakeNewClient()">
</form>
</body>
</html>
jrolinson
 
Posts: 0
Joined: Mon Mar 24, 2008 11:00 am

Who is online

Users browsing this forum: No registered users and 2 guests