![]() |
|
|
|
|
|||||||
| Javascript / Java Applets Are you a JavaScript guy? Do you need help with JavaScript? This is the place to talk about anything related to Java. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm looking for JavaScript code for banner rotation. I want to be able to adjust the time interval for changing of the banners in website from my hosting?
|
|
#2
|
||||
|
||||
|
HTML Code:
<script language="javascript"> var banner1 = new Image(); var banner2 = new Image(); banner1.src = "./path/banner1.jpg"; banner2.src = "./path/banner2.jpg"; function change() { obj = document.getElementById('banner'); if(obj.src == banner1.src) obj.src = banner2.src; else obj.src = banner1.src; } setInterval("change();", 3000); </script> <img src="./path/banner1.jpg" id="banner" alt=""/> banner2.src = -> set the path to the banner 2 setInterval("change();", 3000); -> specify in what time interval to rotate banners. 1000 is equals to 1 sec. |
|
#3
|
|||
|
|||
|
thanks for this one.
![]()
|
![]() |
| Tags |
| banner, code, hosting, javascript, rotation |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|