//好笨啊,这个居然忘记了,在行间家onclick事件要加();,addEventListener只要使用函数名字就好了
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body onclick="fn1()">
sdf
	<div onclick="fn">click这种绑定事件的方式是加()的,奇葩啊</div>
</body>
<script>
function fn1(){
	alert(1)
}
</script>
</html>

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-06
  • 2021-07-08
  • 2021-12-04
  • 2021-06-10
  • 2021-09-18
猜你喜欢
  • 2021-07-09
  • 2021-11-17
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案