I want my form to be validated that is no field should be empty.....i have tried some code on field only but its not working...please help
<html>
<head>
<title>city talkies acccount</title>
<style type="text/css"><!--
p { font-size: smaller; font-family: sans-serif;align:center;}
-->
</style>
<body bgcolor="">
<script type="text/javascript">
function validate_form ( )
{
valid = true;
if ( document.input.firstname.value == "" )
{
alert ( "Please fill in the 'Your Name' box." );
valid = false;
}
return valid;
}
</script>
if(firstname==null)
{
alert("enter your name");
}
</script>
<br>
<table width=100% align="center" bgcolor="CCCCFF"style=margin-bottom:5>
<tr>
<td style="font-family:arial;text-align:center;font-weight:bold;font-size:20;"><b>Create your Account</b></td>
<image src="earth.gif"/>
</tr></table><br>
<br>
<br>
<br>
<table align="center" bgcolor="F0F8FF">
<tr>
<td>
<h2 align="center"></h2>
<br>
<br>
<p>
<form name="input" action="showlogin.jsp" onsubmit="return validate_form ( );">
">
<table>
<tr>
<td align="right"
valign="middle" width="100% font="verdana">
First name:
<input type="text" name="firstname" >
<br>
Last name:
<input type="text" name="lastname">
<br>
Address:
<input type="text" name="address">
<br>
Mobile.no.:
<input type="text" name="number">
<br>
Email-id:
<input type="text" name="email">
<br>
*Username:
<input type="text" name="user">
<br>
*Password:
<input type="password" name="password">
<br><p align="center"><input type="submit"
value="create my account">
</input>
</p>
</p>
</td>
</tr>
</table>
</form>
</td></tr></table>
</body>
</html>