<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<p onclick="e0()" id="id0" class="class0">e0</p><br>
<p onclick="e1()" id="id1" class="class1">e1</p>
</body>
</html>
<script>
function e0(){
c(event);
}
function e1(){
var event = window.event
c(event);
}
function c(e){
console.log('--->');
console.log(e);
console.log(e.target);
console.log(e.target.getAttribute('id'));
console.log(e.target.getAttribute('class'));
}
</script>

https://developer.mozilla.org/en-US/docs/Web/API/Event

  1. MDN
  2. Web technology for developers
  3. Web APIs
  4. Event

The Event interface represents any event which takes place in the DOM; some are user-generated (such as mouse or keyboard events), while others are generated by APIs (such as events that indicate an animation has finished running, a video has been paused, and so forth). There are many types of event, some of which use are other interfaces based on the main Event interface. Event itself contains the properties and methods which are common to all events.

event chrome firefox 获取点击对象的 id 类的更多相关文章

  1. jQuery获取点击对象的父级

    一.使用$('body').on('click','.index',function(event){})绑定事件时,例: <div class="project-box"&g ...

  2. JQuery通过click事件获取当前点击对象的id,name,value属性等

    $(".test").click(function () { var val=$(this).attr("id"); })

  3. C#获取EF实体对象或自定义属性类的字段名称和值

    在年前上班的时候遇到了一个问题是这样描述的:我前台设计一个页面,是标签和文本框,当用户修改了哪个文本框的值,将该修改前的值.修改后的值,该值对应的字段,该值对应的行id获取到保存到数据库的某张表里.现 ...

  4. jquery 获取点击事件的id;jquery如何获取当前触发事件的控件ID值

    写html时这样绑定 <input type="text" name="address4" id="address4" onFocus ...

  5. 点击文字弹出一个DIV层窗口代码 【或FORM表单 并且获取点击按钮的ID值】

    点击不同按钮咨询不同的 专家 <?php for($i=1;$i<5;$i++){ $uid=$i; //用户ID ?> <a class="a_click" ...

  6. 获取点击元素的id

    1.onclick="dianji(this.id)" 传入id到方法里function dianji(id){ //这个就是id}2. $(document).click(fun ...

  7. vue.js click点击事件获取当前元素对象

    Vue.js可以传递$event对象 <body id="app"> <ul> <li v-on:click="say('hello!', ...

  8. jquery中获取当前点击对象

    jquery中获取当前点击对象的简单方法就是,在点击事件click中传入event对象 click(function(event)); 调用当前对象就是$(event.target);

  9. easyui获取当前点击对象tabs的title

    现在如果要关闭一个tab,只能点击该tab上面的x号.现增加双击tab使其关闭. 可使用jquery的bind函数绑定dblclick双击事件 tabs的关闭方法为close 要传一个title参数表 ...

随机推荐

  1. Unity3D发布安卓报错permisson denied的解决

    没有打开SD卡的写入权限 unity提供了sd卡权限修改的参数:

  2. atitit.软件设计模式大的总结attialx总结

    atitit.软件设计模式大的总结attialx总结 1. 设计模式的历史3 2. 设计模式的数量(253个)3 3. 设计模式的结构4 3.1. 应用场景and条件Context4 3.2. Pro ...

  3. iOS网络访问之使用AFNetworking

    AFNetworking是IOS上常用的第三方网络访问库,我们可以在github上下载它,同时github上有它详细的使用说明,最新的AFNetworing2.0与1.0有很大的变化,这里仅对2.0常 ...

  4. lua 小技巧

    lua 小技巧 把常用的工具函数添加到 _G 里面,所有的文件都可以直接调用: ``` lua -- 在 a 文件中将工具函数添加到 _G: _G.IsEmptyStr = function(str) ...

  5. neo4j使用笔记

    #coding:utf- __author__ = 'similarface' # 安装驱动:pip install neo4j-driver from neo4j.v1 import GraphDa ...

  6. java虚拟机的逃逸分析

    逃逸分析作为其他优化手段提供依据的分析技术,其基本行为就是分析对象动态作用域:当一个对象在方法中被定义后,它可能被外部方法所引用,例如作为调用参数传递到其他方法中,称为方法逃逸.甚至还有可能被外部线程 ...

  7. Compiler Error C2872: ambiguous symbol

    参考资料:http://blog.csdn.net/greytree/article/details/354530 刚才写的程序报错ERROR C2872(CL.exe)原因很简单 ZThread有定 ...

  8. jedis CodedInputStream encountered a malformed varint

    原因:从redis数据库中根据String类型的参数取数据时报的异常 解决方法:应该用字节数组读取低层次的数据,因为是我们自定义的一些对象格式,如图: 这样就不报错了,可以正常读取redis数据库中的 ...

  9. 初识md5碰撞与crc32碰撞

    现在是晚上23:29.写这篇文章呢,是因为早些时候我胃疼,是因为凉导致的胃疼.凉呢喝了一些热水,喝完热水胃倒是不疼了,但是由于我喝的是茶叶开水,于是就导致失眠了.想来想去这漫漫长夜也没意思,于是就决定 ...

  10. 开源Bug管理系统Redmine安装和使用心得

    最终忍受不了公司使用论坛+Excel来进行bug反馈和管理工作了,于是花了一个上午时间研究了下bug管理系统.这样一个bug管理系统能够轻松的查看bug新增了哪些,攻克了哪些.当前是谁,要在什么时间解 ...