Mass participation event object event

Event objects Event
1. compatible

function(event){
	//var event = event || window.event;
	var event =  window.event || arguments.callee.caller.arguments[0];  //火狐的兼容写法
}

2. Call

  //事件
function add (event){
    console.log(event)
}

1.html call

<!-- 正确使用 -->
    <div onClick="add(event)">点击</div>

There are call the event object 2. The method method

function use(event){  //这里也要传event
	add (event);
}

Summary: method invocation event, it must also pass a event, otherwise the low version of the browser will complain.

Published 47 original articles · won praise 4 · Views 6695

Guess you like

Origin blog.csdn.net/lifangfang0607/article/details/90373649