トップページ >  javascript >  現在アクティブな要素の取得
初版2013/01/15: 最終更新日2013/01/15
  現在アクティブな要素の取得
目次
現在アクティブな要素の取得(IE8)
現在アクティブな要素の取得(IE8)
現在アクティブな要素を取得するには、document.activeElement と記述します。Chrome23ではundefinedとなります。
戻り値はオブジェクトになります。



以下、ソースです。

<script language="JavaScript">
<!--
function a(){
    alert(document.activeElement.type);
    alert(document.activeElement.name);
    alert(document.activeElement.id);
}
// -->
</script>