Javascript Dummy
-
Javascript Dummy
Javascript newbie Q!!
Doing a simple Form with a Javascript validating that i am inputing something before i submit it!
Please help me coz i have no idea whats wrong with my code!!!
Next is the Javascript then the form!
-
Here's the Form within the <BODY> tags
<table class="ftable">
<tr>
<td align="center">
<h4>Please Enter Your Unername and Password where appropriate</h4>
<!--################################################## ###################################
##### Form for loging in. A valid username and password should be entered ###############
################################################## ################################### -->
<form name="enter" action="" onSubmit="return checkentry(enter);">
</td>
</tr>
<tr>
<td align="center">Username
<input name="userid" type="text">
</td>
</tr>
<tr>
<td align="center">Password
<input name="password" type="password">
</td>
</tr>
<tr>
<td align="center">
<input value="Enter" type="Submit" name="Submit">
<input value="Reset" type="Reset">
</form>
</td>
</tr>
</table>
-
here's the javascript implimented in <HEAD> tags
<script type="text/javascript" language="javascript">
<!--
function checkentry(enter)
if ("" == document.enter.userid.value)
{
alert("Please Enter Username!");
document.enter.userid.focus();
return false;
}
if ("" == document.enter.password.value)
{
alert("Please Enter Passord!");
document.enter.password.focus();
return false;
}
//-->
</script>
-
any help will be much appreciated .... thanks