案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
4
<script type="text/javascript">
5
txtsize=0
6
maxsize=100
7
8
function writemsg()
9
{
10
if (txtsize<maxsize)
11
    {
12
    document.getElementById('msg').style.fontSize=txtsize
13
    txtsize++
14
    timer=setTimeout("writemsg()",10)
15
    }
16
}
17
18
function stoptimer()
19
{
20
clearTimeout(timer)
21
}
22
</script>
23
</head>
24
<body onload="writemsg()" onunload="stoptimer()">
25
<p id="msg">W3xue.com!</p>
26
</body>
27
</html>
28