event chrome firefox 获取点击对象的 id 类
<!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
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 类的更多相关文章
- jQuery获取点击对象的父级
一.使用$('body').on('click','.index',function(event){})绑定事件时,例: <div class="project-box"&g ...
- JQuery通过click事件获取当前点击对象的id,name,value属性等
$(".test").click(function () { var val=$(this).attr("id"); })
- C#获取EF实体对象或自定义属性类的字段名称和值
在年前上班的时候遇到了一个问题是这样描述的:我前台设计一个页面,是标签和文本框,当用户修改了哪个文本框的值,将该修改前的值.修改后的值,该值对应的字段,该值对应的行id获取到保存到数据库的某张表里.现 ...
- jquery 获取点击事件的id;jquery如何获取当前触发事件的控件ID值
写html时这样绑定 <input type="text" name="address4" id="address4" onFocus ...
- 点击文字弹出一个DIV层窗口代码 【或FORM表单 并且获取点击按钮的ID值】
点击不同按钮咨询不同的 专家 <?php for($i=1;$i<5;$i++){ $uid=$i; //用户ID ?> <a class="a_click" ...
- 获取点击元素的id
1.onclick="dianji(this.id)" 传入id到方法里function dianji(id){ //这个就是id}2. $(document).click(fun ...
- vue.js click点击事件获取当前元素对象
Vue.js可以传递$event对象 <body id="app"> <ul> <li v-on:click="say('hello!', ...
- jquery中获取当前点击对象
jquery中获取当前点击对象的简单方法就是,在点击事件click中传入event对象 click(function(event)); 调用当前对象就是$(event.target);
- easyui获取当前点击对象tabs的title
现在如果要关闭一个tab,只能点击该tab上面的x号.现增加双击tab使其关闭. 可使用jquery的bind函数绑定dblclick双击事件 tabs的关闭方法为close 要传一个title参数表 ...
随机推荐
- Varnish 简介
Varnish是高性能开源的反向代理服务器和HTTP缓存服务器 Varnish的功能与Squid服务器相似,都可以用来做HTTP缓存 Squid是从硬盘读取缓存的数据,而Varnish把数据存放在内存 ...
- atom搭建markdown环境及问题
1. 搭建markdown环境 > 禁用atom自带的markdown-preview插件(功能简单) > 安装插件:markdown-preview-plus@2.4.16(在markd ...
- [转]鼠标和键盘模拟API
几乎所有的游戏中都使用了鼠标来改变角色的位置和方向,玩家仅用一个小小的鼠标,就可以使角色畅游天下. 那么,我们如何实现在没有玩家的参与下角色也可以自动行走呢.其实实现这个并不难,仅仅几个Windows ...
- Atiti. Php Laravel 5.1 环境搭建以及 error 排除
Atiti. Php Laravel 5.1 环境搭建以及 error 排除 1. php_5.6.11_apache2.41 1.1. Httpd.Conf增加以下配置,添加php支持1 1.2. ...
- druid问题记录
1 {"error":"Instantiation of [simple type, class io.druid.indexing.kafka.supervisor.K ...
- 使用tar+lz4/pigz+ssh更快的数据传输
使用tar+lz4/pigz+ssh更快的数据传输 -- | :41分类:Linux,MySQL | 前面一篇介绍了如何最大限度的榨取SCP的传输速度,有了这个基础,就可以进一步的使用压缩来加速传输速 ...
- C预编译宏
/* ============================================================================ Name : c_test001.c A ...
- hive执行更新和删除操作
Hive从0.14版本开始支持事务和行级更新,但缺省是不支持的,需要一些附加的配置.要想支持行级insert.update.delete,需要配置Hive支持事务. 一.Hive具有ACID语义事务的 ...
- tomocat解决乱码问题
使用Tomcat进行JSP开发最头疼的莫过于中文乱码问题了,总结Tomcat乱码问题出现的原因必须明白以下几点: 1.Tomcat一般总是默认使用ISO-8859-1作为字符编码方式的.所以,除非你在 ...
- zend studio 10.6.2 字体大小 设置
如果汉化的:窗体-->常规-->外观-->颜色和字体-->基本-->文字字体 点击编辑 如果未汉化:Window->Preferences->General ...