Tuesday, April 24, 2007

java script validation

//java script

function CheckFields(frm)
{

if(frm.sitename.value == 0)
{
alert("Please Enter site name!");
frm.sitename.focus();
return false;
}
if(frm.siteurl.value == 0)
{
alert("Please Enter site url!");
frm.siteurl.focus();
return false;
}

if (frm.discription.value.length == 0)
{
alert("Please enter site discription!");
frm.discription.focus();
return false;
}

}

//callling function by click on this button

<input type="submit" name="Submit" value="Submit" onClick='return CheckFields(this.form);'>

No comments: