案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function blinking_header()
5
{
6
if (!document.getElementById('blink').style.color)
7
    {
8
    document.getElementById('blink').style.color="red"
9
    }
10
if (document.getElementById('blink').style.color=="red")
11
    {
12
    document.getElementById('blink').style.color="black"
13
    }
14
else
15
    {
16
    document.getElementById('blink').style.color="red"
17
    }
18
timer=setTimeout("blinking_header()",100)
19
}
20
21
function stoptimer()
22
{
23
clearTimeout(timer)
24
}
25
</script>
26
</head>
27
28
<body onload="blinking_header()" onunload="stoptimer()">
29
<h1 id="blink">闪动的标题</h1> 
30
</body>
31
32
</html>
33