摘要:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JS事件练习</title>
</head>
<body>
<script type="text/javascript">
function myfovus(x){
x.style.background="red"
}
function myfovus(y){
y.style.background="red"
}
</script>
<input type="text" onmousemove="myfovus(this)">
<input type="text" onfocus="myfovus(this)">
<div style="width:100px; height: 100px;border:1px solid #ccc;" onclick="myfovus(this)"></div>
</body>
</html>
批改老师:天蓬老师批改时间:2019-01-24 17:16:51
老师总结:onclick="myfovus(this)", 这种添加事件的方式,是DOM1级, 可以试一下其它方法添加, 这种并不是最佳方案