I have a web page in which I want an image slideshow when the page loads.
I have the following code:
<SCRIPT LANGUAGE="JavaScript">
//set image paths
src = ["images/pic1.jpg", "images/pic2.bmp", "images/pic3.jpg"]
//set duration for each image
duration = 3;
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads
[n].complete==null))
{document["Ad_Image"].src = ads [ct=n].src;}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);}
function doLink(){
} onload = function(){
if (document.images)
switchAd();}
</SCRIPT>
<A HREF=http://www.webdeveloper.com/forum/archive/index.php/"java script:doLink();" onMouseOut="status=''"><IMG NAME="Ad_Image" SRC=http://www.webdeveloper.com/forum/archive/index.php/"images/Pic1.jpg" BORDER=0 width="150" length="120"></A>
This works if the mouse moves over the pic.
How can I change this so that the slideshow begins when the page loads without any mouse interaction.
Thanks,
Ninel
I have the following code:
<SCRIPT LANGUAGE="JavaScript">
//set image paths
src = ["images/pic1.jpg", "images/pic2.bmp", "images/pic3.jpg"]
//set duration for each image
duration = 3;
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads
[n].complete==null))
{document["Ad_Image"].src = ads [ct=n].src;}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);}
function doLink(){
} onload = function(){
if (document.images)
switchAd();}
</SCRIPT>
<A HREF=http://www.webdeveloper.com/forum/archive/index.php/"java script:doLink();" onMouseOut="status=''"><IMG NAME="Ad_Image" SRC=http://www.webdeveloper.com/forum/archive/index.php/"images/Pic1.jpg" BORDER=0 width="150" length="120"></A>
This works if the mouse moves over the pic.
How can I change this so that the slideshow begins when the page loads without any mouse interaction.
Thanks,
Ninel