Javascript Form How to - Handle focus lost event from Radio button








Question

We would like to know how to handle focus lost event from Radio button.

Answer


<!--from   w w w .  j a v a 2  s  .com-->
<html>
<body>
    <script language="JavaScript">
    function showChange(){
         document.form1.text1.value = "Focus removed from Radio Button";
    }
    </script>
    <form name="form1">
        Click the radio button first, then click in the text area.
        <br><br>
        <input type="radio" name=button1 onBlur='showChange()'>Box 1
        <br>
        Click the text box
        <input type="text" name="text1" size=40>
        <br>
    </form>
</body>
</html>

The code above is rendered as follows: