<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
<SCRIPT type = "text/JavaScript">
VaR arr = new array;
Arr [0] = "../images/slide-01.jpg ";
Arr [1] = "../images/slide-02.jpg ";
Arr [2] = "../images/slide-03.jpg ";
VaR timer = setinterval (play, 1000 );
VaR COUNT = 1;
Function play (){
If (ARR. Length = count)
Count = 0;
Document. getelementbyid ("pic"). src = arr [count];
Count ++;
}
Function cleartimer (){
Clearinterval (timer );
}
Function onmouseover (OBJ ){
Cleartimer ();
VaR Index = parseint (obj. value );
Document. getelementbyid ("pic"). src = arr [index-1];
Count = index;
}
Function btnmouseout (){
Timer = setinterval (play, 1000 );
}
Function Init (){
VaR btns = Document. getelementsbytagname ("input ");
For (VAR I = 0; I <btns. length; I ++ ){
Btns [I]. onmouseout = btnmouseout;
}
}
</SCRIPT>
</Head>
<Body onload = "Init ()">
<br/>
<Input type = "button" value = "1" id = "1" onmouseover = "onmouseover (this)"/>
<Input type = "button" value = "2" id = "2" onmouseover = "onmouseover (this)"/>
<Input type = "button" value = "3" id = "3" onmouseover = "onmouseover (this)"/>
</Body>
</Html>
Http://blog.csdn.net/wjr_loves/article/details/7865537
Simplest image carousel