Checkbox.focus() : CheckBox : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » CheckBox »

 

Checkbox.focus()









Syntax








document.form.checkbox.focus()



The focus() method applies focus to a check box without invoking the checkbox's onFocus event handler.












<html>
    <form name="myForm">
      <input type="checkbox" name="checkBox1">Option 1<br>
      <input type="checkbox" name="checkBox2">Option 2<hr>
      <input type="button" name="focusButton" value="Move Focus" onClick="moveFocus()">
    </form>
    <script language="JavaScript">
    <!--
    function moveFocus() {
      document.myForm.checkBox1.focus();
    }
    -->
    </script>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» CheckBox