Slideshow gambar muncul secara acak

Demo :




Cara membuatnya

Dari Dashboard >> Design >> Edit HTML.


Penempatannya
dibawah <body>
........
diatas </body>

<script type='text/javascript'>
//<![CDATA[

/*
Slideshow gambar muncul secara acak By Tyler Clarke (http://www.ihatecoffee.com/)
*/

var delay=1000 //set delay in miliseconds
var curindex=0

var randomimages=new Array()

 randomimages[0]="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv4eQ0f5s6KZbEP088qa04ADkPCvbXPQoOnhIaf1bcYeNJklMw9MXodNzNgvQy2dLcYsEhQ_uRvuc7ubCJejnzuGdv2QBO3h_TixxveTseU7NMgDqnhdeChvwu955V1TJ3_L-SeXexlGpH/s104/Nano+Yulianto+-+1.jpg"
 randomimages[1]="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLDs8EEKc8dntKHRk6riga0eykcFp0qJajq1FjDUlgK4DzEqgUCjatUnEOvADGPX2fyPzwb1S_Y8hNjNqaDb3M1JIaT-aqmNaTRwouMa0PcNyoK6l2vQ11_Nvgxtjm_QRbhV3xTN1Y1tnL/s104/Nano+Yulianto+-+5.jpg"
 randomimages[2]="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuJTDgQaKKJK_o8080QXikAKPWM3viwNAEH9Ev5ifiA6Yvjc3xE9ldaKfroi-ObbKjpTCCAPXcuF9WKDsVhmLx6XaeAgCaYLrUL15MgBS5vA6QqhAwPRu_d7dwqUSUajl-r7M79dRar8Qs/s104/Nano+Yulianto+-+2.jpg"
 randomimages[3]="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitzG1rlAWEtfc8eZjf6V_tXKleoUc8dxGFFDVbbgfzF4TqYxSY-QkNKgKi-gYsJrZkzShZj8nvD1_NAjDjAba18NOaXbfj7S1gbPrAiGcee0qKFCB7API7zaAWHp5VRwTL71_2wpmwRzc2/s104/Nano+Yulianto+-+4.jpg"
 randomimages[4]="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC-l__yPLu5GUd8krb92HRM6JQN_xyxCircjrlaAvDnmb9U-R_FXNkykDKG2Cw9pJVZe98LJkBQ7vTsYvc_0Amvo3oDnt8XlLsos4iZo7rmLgIsJdSXC44x5WMfxohlyBYwqte12RyAflv/s104/Nano+Yulianto+-+3.jpg"

var preload=new Array()

for (n=0;n<randomimages.length;n++)
{
 preload[n]=new Image()
 preload[n].src=randomimages[n]
}

document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')

function rotateimage()
{

if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
curindex=curindex==0? 1 : curindex-1
}
else
curindex=tempindex

 document.images.defaultimage.src=randomimages[curindex]
}

setInterval("rotateimage()",delay)

//]]>
</script>



Credit : Tyler Clarke

Alhamdulillah

0 comments:


Posting Komentar


Creative Commons License
Slideshow gambar muncul secara acak by Nano Yulianto is licensed under a Creative Commons Attribution 3.0 Unported License.
Based on a work at http://nanoyulianto.blogspot.com/2011/01/slideshow-gambar-muncul-secara-acak.html.
Permissions beyond the scope of this license may be available at http://nanoyulianto.blogspot.com/.