- This is a method of the text box, which basically forces the cursor to be at the specified text box. onsubmit Unlike onblur, onsubmit handler is inserted inside the <form> tag, and not inside any one element.
- For example:
<script>
<!--
function validate()
{
if(document.login.userName.value=="")
{
alert ("Please enter User Name")
document.login.userName.focus()
return false
}
if(document.login.password.value=="")
{
alert ("Please enter Password")
document.login.password.focus()
return false
}
}
//-->
</script>
<form name="login" onsubmit="return validate()">
Enter your name: <input name="userName" />
Enter your Password: <input name="password" />
<input name="submit" type="submit" /></form>
Subscribe to:
Post Comments
(
Atom
)
0 comments :
Post a Comment