案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<style>
4
span
5
{
6
font:12px arial;
7
background:#CCCCCC;
8
position:absolute;
9
width:100;
10
height:500;
11
top:100;
12
clip:rect(0 100 100 0);
13
}
14
</style>
15
<script type="text/javascript">
16
var interval
17
startPosition=0
18
topPosition=100
19
endPosition=100
20
speed=50
21
22
function scrollit()
23
{
24
if (startPosition!=200)
25
    {
26
    startPosition=startPosition+1
27
    topPosition=topPosition-1
28
    document.getElementById('display').style.clip="rect(" + (startPosition + 1) + " 100 " + (startPosition + endPosition) + " 0)"
29
    document.getElementById('display').style.top=topPosition
30
    interval=setTimeout("scrollit()",speed)
31
    }
32
else
33
    {
34
    startPosition=0
35
    topPosition=100
36
    endPosition=100
37
    interval=setTimeout("scrollit()",speed)
38
    }
39
}
40
41
function stopinterval()
42
{
43
clearTimeout(interval)
44
}
45
</script>
46
</head>
47
48
<body onload="scrollit()" onunload="stopinterval()">