Active Element : document « Javascript Objects « JavaScript DHTML






Active Element

 
    
<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.'expando' Example
2.Document 'URLUnencoded' Example
3.'URL' Example
4.Create a Comment
5.'write()' Example
6.'writeln()' Example
7.Execute Command
8.Document parentWindow
9.Document referrer
10.Document compatMode
11.Document design Mode
12.Document doctype
13.Document Domain
14.Document title Example
15.Document Link color
16.Use document.links collection
17.Print page out
18.Expose the prperties of Objects