Script Categories

Forms >>> Validation Info.

Test the powers of Javascript. Watch as Javascript tells you if information about you is valid or not.

Name: Age:

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function validate(){
var digits="0123456789"
var temp
if (document.testform.Name.value=="") {
alert("No Name !")
return false
if (document.testform.age.value=="") {
alert("Invalid Age !")
return false
for (var i=0;i<document.testform.age.value.length;i++){
if (digits.indexOf(temp)==-1){
alert("Invalid Age !")
return false
return true
// End -->
<FORM name="testform" onSubmit="return validate()">
Name:<input type="text" size=30 name="Name">
Age:<input type="text" size=3 name="age">
type="submit" value="Submit">

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).