/ Published in: HTML
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> var pictureArchive= ['1.jpg','2.jpg','3.jpg','4.jpg']; window.onload=function() { var o=document.createElement('img'); o.setAttribute('id', 'image'); o.setAttribute('src', pictureArchive[0]); o.setAttribute('alt', ''); document.body.appendChild(o); rotate(pictureArchive.length); } function rotate(idx) { if(idx>=pictureArchive.length) { idx=0; } document.getElementById('image').src=pictureArchive[idx++]; timerID=setTimeout('rotate('+idx+')', 4000); } </script> <style type="text/css"> </style> </head> <body> </body> </html>
URL: http://www.webdeveloper.com/forum/showthread.php?t=186968