01.
<html>
02.
<head>
03.
<script type=
"text/javascript"
>
04.
function
ValidateForm()
05.
{
06.
var
input = document.getElementsByTagName(
'INPUT'
);
07.
for
(
var
i = 0, n = input.length; i < n; i = i + 1) {
08.
09.
if
(!input[i].value) {
10.
alert(
"PLease Enter '"
+ input[i].attributes.item(1).nodeValue+
"' value. "
)
11.
input[i].focus();
12.
return
false;
13.
}
14.
}
15.
}
16.
</script>
17.
</head>
18.
<body>
19.
<form action=
"registerformsave.php"
method=
"post"
name=
"frmMain"
onSubmit=
"return ValidateForm();"
>
20.
<input type=
"text"
name=
"FirstName"
id=
"FirstName"
/>
21.
<input type=
"text"
name=
"LastName"
id=
"LastName"
/>
22.
<input type=submit value=
"sumit"
>
23.
</form>
24.
</body>
25.
</html>