<!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. unity, itween 对不透明对象使用FadeTo需要先更换material

    跟自己实现fade一样,使用itween对不透明对象FadeTo前也要先更换material为透明material. 设player的Hierarchy如下: player --aniRoot --- ...

  2. 批量Linux、Windows管理工具BatchShell 1.2(最新版)

    简介: BatchShell是什么: BatchShell是一款基于SSH2的批量文件传输及命令执行工具,它可以同时传输文件到多台远程服务器以及同时对多台远程服务器执行命令.具备以下主要功能:     ...

  3. zookeeper(一):功能和原理

    简介 ZooKeeper 是一个开源的分布式协调服务,由雅虎创建,是 Google Chubby 的开源实现.分布式应用程序可以基于 ZooKeeper 实现诸如数据发布/订阅.负载均衡.命名服务.分 ...

  4. Bash中的括号(二)

    双方括号[[]]的用法: 1.先举个例子说明: 假如你要再判断某个目录是否存在,又想当然写成: $ [ -f exists.txt && -d exists_folder ]; ech ...

  5. 设计模式_CallBack

    一.基本概念 if you call me, i will call back 什么是回调函数  回调函数(callback Function),顾名思义,用于回调的函数. 回调函数只是一个功能片段, ...

  6. Unity对象与Draw Calls的关系

    什么是Draw Calls? 首先我们先来了解一下,什么叫做“Draw Calls”:一个Draw Call,等于呼叫一次 DrawIndexedPrimitive (DX) or glDrawEle ...

  7. JSON学习【转自慕课网】

    视频网址 从慕课网视频里的PPT截图过来的,因为是用PHP讲的,而且后面讲的一般,所以只截取了前两节课的基础内容,其实只看一下第一张PPT就可以了.

  8. extjs,ComboReturn

    package cn.edu.hbcf.common.vo; import java.io.Serializable; public class ComboReturn implements Seri ...

  9. cocos2dx触摸

    两种方法其实都一样,CCLayer也是继承CCTouchDelegate. 1.继承CCTouchDelegate 添加触摸代理 CCTouchDispatcher* pDispatcher = CC ...

  10. IPC之共享内存

    man 7 shm_overview shm_overview - Overview of POSIX shared memory. 同样,SystemV实现的共享内存是旧的机制,但应用广泛:Posi ...