x
1
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<title>蜜蜂教程(mifengjc.com)</title>
6
<style>
7
#myDIV {
8
border: 1px solid black;
9
}
10
</style>
11
</head>
12
<body>
13
14
<div id="myDIV">该实例演示了如何向 DIV 元素添加 "wheel" 事件。在这个区域上下滚动鼠标滚轮!</div>
15
<p>当你在 div 元素中滚动鼠标滚轮时,脚本函数会设置 div 的字体大小为 35 像素。</p>
16
<p><strong>注意:</strong> Internet Explorer 和 Safari 浏览器不支持 wheel 事件</p>
17
<script>
18
function myFunction() {
19
document.getElementById("myDIV").style.fontSize = "35px";
20
}
21
</script>
22
23
</body>
24
</html>