`
zhangyaochun
  • 浏览: 2566438 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

document.activeElement

阅读更多

  document.activeElement

 

--------- 返回当前获得焦点元素只读

  

           如果没有选中,active的元素是body

 

  浏览器支持:

 

  • Chrome2+
  • ff3+
  • IE4+
  • Opera 9.6+
  • Safari 4+

 

 

 

 

  扩展阅读:

 

  https://developer.mozilla.org/en-US/docs/DOM/document.activeElement

分享到:
评论

相关推荐

    event.currentTarget和document.activeElement用法

    firefox 的 event.currentTarget 和 ie 的 document.activeElement 这两个完全含义不一致的对象却被捆绑在一起做成了浏览器兼容代码。 大家在google搜索的时候 都会发现 document.activeElement || event....

    超级JS代码实例大全

    document.activeElement 绑定事件 document.captureEvents(Event.KEYDOWN); 访问窗体元素 document.all("txt").focus(); document.all("txt").select(); 窗体命令 document.execCommand 窗体COOKIE ...

    JavaScript技巧大全(ie)

    document.activeElement •绑定事件 document.captureEvents(Event.KEYDOWN); •访问窗体元素 document.all("txt").focus(); document.all("txt").select(); •窗体命令 document.execCommand ......

    javascript 常用方法及技巧

    document.activeElement 绑定事件 document.captureEvents(Event.KEYDOWN); 访问窗体元素 document.all("txt").focus(); document.all("txt").select(); 窗体命令 document.execCommand 窗体COOKIE ...

    超级实用且不花哨的js代码大全

    document.activeElement • 绑定事件 document.captureEvents(Event.KEYDOWN); • 访问窗体元素 document.all("txt").focus(); document.all("txt").select(); • 窗体命令 document.execCommand

    Javascript事件教程小技巧

    Javascript小技巧,觉得用来查询JS的事件挺方便,主要是事件源对象event... 窗体活动元素 document.activeElement  绑定事件  document.captureEvents(Event.KEYDOWN);  访问窗体元素 document.all("txt").focus();

    java代码大全

    document.activeElement • 绑定事件 document.captureEvents(Event.KEYDOWN); • 访问窗体元素 document.all("txt").focus(); document.all("txt").select(); • 窗体命令 document.execCommand • 窗体...

    BlurTest例子

    BlurTest例子程序,参考自Android高级模糊技术,http://blog.jobbole.com/63894/

    js 判断控件获得焦点的示例代码

    JS判断一个对象已获得焦点document.activeElement.tagName //tagName 标签名 实例:判断body获得光标时关闭输入法。 代码如下:var act = document.activeElement.tagName.toLowerCase(); if(act.indexOf(“body”) ...

    js实现同一个页面,多个enter事件绑定的示例

    if(ev.keyCode == 13 && document.activeElement.id == "") {//activeElement活动事件,该事件只可以使用于输入域中 console.log("内容111:" + document.activeElement.value); }else if(ev.keyCode==13&& doc

    使用js判断控件是否获得焦点

    使用JS获取具有焦点控件的ID: 代码如下:$(“#textID”).click(function(){var act = document.activeElement.id;if(act == “textID” ){ alert(“true”);}else{ alert(“false”);}} );使用...

    js使用小技巧

    窗体活动元素 document.activeElement 绑定事件 document.captureEvents(Event.KEYDOWN); 访问窗体元素 document.all("txt").focus(); document.all("txt").select(); 窗体命令 document.execCommand ...

    在textarea中屏蔽js的某个function的javascript代码

    document.activeElement 得到当前网页聚焦的那个控件, 判断这个若是这个 textarea 则跳出不执行本函数 2楼 楼上正解,向meizz学习 3楼 to meizz(梅花雪) 我是用 document.activeElement.tagName.toLowerCase...

    利用WebBrowser彻底解决Web打印问题(包括后台打印)

    var focused = document.activeElement;window.printHelper = function() {execScript("on error resume next: printWB.ExecWB 6, 1", "VBScript");printFireEvent(frame, eventScope, "onafterprint");printWB....

    jQuery中使用了document和window哪些属性和方法小结

    document.activeElement获取文档当前获得焦点的元素 document.head在jQuery中使用方式如下document.head || document.getElementsByTagName( “head” )[0] ,可见并非所有浏览器支持 document.body获得当前文档的...

    JavaScript焦点事件、鼠标事件和滚轮事件使用详解

    一般利用这些事件与document.hasFocus()方法和document.activeElement属性配合。主要有: blur:元素失去焦点,不会冒泡; DOMFocusIn:同HTML事件focus,于DOM3遭废弃,选用focusin; DOMFocusOut:同HTML事件blur...

    C#中WebBroeser控件用法实例教程

    WebBrowser是C#中非常实用的一个控件,本文以实例形式分析了WebBrowser的用法,供大家参考。具体分析如下: 一、WebBrowser常用属性: ...Uri a = new Uri(WebBrowser.Document.ActiveElement.GetAtt

    JavaScript事件类型中焦点、鼠标和滚轮事件详解

    一般利用这些事件与document.hasFocus()方法和document.activeElement属性配合。主要有: blur:元素失去焦点,不会冒泡; DOMFocusIn:同HTML事件focus,于DOM3遭废弃,选用focusin; DOMFocusOut:同HTML事件...

    chrome下判断点击input上标签还是其余标签的实现方法

    如图 本想通过如下代码来实现 $(".search-input").focusout... if (document.activeElement.className !== 'close-t') {//close-t为清除键类名 $('.search-input').addClass('search-before'); $('.close').css

Global site tag (gtag.js) - Google Analytics