|
Hi guys,
For a scipt im writing I need to refer to a form field using the elements array.
I created a basic script just to send me back the contents of the textfield in an alert box but it doesnt work and I cant figure out what im doing wrong.
Please help.. my code is below
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
function validateThis(form){
alert(form.elements[0].value);
return false;
}
</script>
<form onsubmit="return validateThis(this.form);" >
<p>Name:
<input type="text" name="textfield" />
</p>
<p>Phone:
<input type="text" name="textfield2" />
</p>
<p>Email:
<input type="text" name="textfield3" />
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>
</body>
</html>
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
|