• 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>

0 comments :

Post a Comment

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger