'activeElement' Example : activeElement « Javascript Properties « JavaScript Reference

'activeElement' Example

    
<html>
<body onLoad="myButton.focus();">
<input type="Button" id="myButton" value="Element 1" onClick="function1();">
<script language="JavaScript">
function function1() {
    var m = document.activeElement.value;
    alert('The active element is '+m); 
} 
</script>
</body>
</html>

    
      
      








Related examples in the same category

1.'activeElement' Syntax and Note
2.'activeElement' is applied to