阅读背景:

js为同一个元素注册多个事件_u014414110的博客

来源:互联网 
<body>
		<input type="button" id="btn" value="11111" />
	</body>
	<script>
		function mm(id){
			
			return document.getElementById(id);
		}
		mm("btn").onclick=f1;
		mm("btn").onmousemove=f1;
		mm("btn").onmouseout=f1;
		
		function f1(e) {
			console.log(e);
			switch (e.type){
				case "click": alert("1");break;
					case "mousemove": alert("2");break;
						case "mouseout": alert("3");break;
				
			}
		}
	</script>
<body>
		<input type="button" id="btn" v



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: