Today inadvertently found on the Internet, the code is very simple, a look at the JS image switching effect code, like simple friends can refer to.
Html:
1 < src= "A1.jpg" width= "478" height= "286" ID = "Showpic" />
The picture can be set by itself, let's take a look at the switch script, and use an array to load the picture together.
1 <Scripttype= "Text/javascript">2 window.onload= function(){ 3 varCurindex= 0;4 varTimerInterval= -; //time interval unit milliseconds5 vararr= NewArray ();6 arr[0] = "a1.jpg";7 arr[1] = "a2.jpg";8 arr[2] = "a3.jpg";9 arr[3] = "a4.jpg";Ten arr[4] = "a5.jpg"; One arr[5] = "a6.jpg"; A arr[6] = "a6.jpg"; - setinterval (changeimg,timerinterval); - functionchangeimg () { the varobj=document.getElementById ('Showpic'); - if(Curindex==Arr.length- 1){ - Curindex= 0; - }Else{ + Curindex+= 1; - } + obj.src=Arr[curindex]; A } at } - </Script>
This piece of code is simple but ingenious.
After testing, automatic switching can be achieved completely.
Very simple JS switching effect (with extrapolate effect)