Here you go.....
Basically there are 2 inputs on the form which are validated (one to see if anything has been entered and the other to check if a number > 0 has been entered).
Hope this helps
<script language="Javascript">
function ValidateForm()
{
document.myForm.ErrCheck.value = "";
ErrMsg = 'ERROR - Incomplete Data' + '\n' + '\n';
if (document.myForm.txtA.value == "")
{
ErrMsg = ErrMsg + 'You need to specify your name.' + '\n';
document.copyrequest.ErrCheck.value = "Error";
document.copyrequest.FileName.style.backgroundColor='#ff0000';
}
if (isNaN(document.myForm.intB.value) || document.myForm.intB.value < 1)
{
ErrMsg = ErrMsg + 'You need to specify your age.' + '\n';
document.myForm.ErrCheck.value = "Error";
}
if (document.copyrequest.ErrCheck.value == "Error")
{
alert(ErrMsg);
}
else
{
document.copyrequest.submit();
}
}
</script>
<form name="myForm" action="page.asp" method=-"post">
<input name="ErrCheck" type="hidden">
Name: <input name="txtA" type="text">
Age (Years): <input name="intB" type="text">
</form>
<input type="button" value="Valid" onClick="ValidateForm()">