案例:HTML DOM案例     状态:可编辑再运行    进入横版
x
document.getElementById('imageviewer').src=myImages[imagecounter]
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
myImages=new Array()
5
myImages[0]="/img/eg_mouse.jpg"
6
myImages[1]="/img/eg_smile.gif"
7
myImages[2]="/img/eg_landscape.jpg"
8
myImages[3]="/img/eg_landscape2.jpg"
9
myImages[4]="/img/eg_landscape3.jpg"
10
myImages[5]="/img/eg_greanfoliage.jpg"
11
imagecounter=myImages.length-1
12
i=0
13
14
function first()
15
{
16
document.getElementById('imageviewer').src=myImages[0]
17
i=0
18
}
19
20
function previous()
21
{
22
if (i>0)
23
    {
24
    i--

 运行结果 
 北美留学生论坛