...

View Full Version : javascript code for slideshow



dumbblonde
11-30-2006, 07:15 PM
I'm building a web site on GeoCities Pro and entered the javascript code for a Random Image Slideshow. The pictures have been uploaded and I have entered the script in 4 different places provided by GeoCities but nothing works. All I see is a box in the body of the page that contains my script. I'm new at all of this sooo please help me. What am I doing wrong???? Thank you.

j9ine
11-30-2006, 10:49 PM
Please post the script that you are currently using and a link to your webpage. I can't really offer any suggestions without seeing your script.

dumbblonde
11-30-2006, 11:36 PM
This is the site where I got the code: http://www.javascriptkit.com/script/script2/randomslide.shtml The website isn't online at this time because the content isn't finished. Thanks for answering me.

j9ine
12-01-2006, 01:45 AM
Copy all of the code below and paste it into a text editor like notepad. Save it as test.htm and open it in your browser to view the slideshow example.


<html>
<body>
<script language="javascript">

/*
Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com)
For this script and more, visit http://www.javascriptkit.com
*/

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

/*Edit the urls listed in the randomimages array to reflect your own images. You can
add as many as you need. Simply add a comma at the end of each url and enclose each
url in quotes. I would recommend using the full url instead of just the filename to
insure that you are referencing the correct location of the image.*/

var randomimages=["http://codingforums.com/images/buttons/edit.gif",
"http://codingforums.com/images/buttons/quote.gif",
"http://codingforums.com/images/buttons/multiquote_off.gif"];

var preload=[],img,curindex,tempindex;

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

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];
}

window.setInterval(rotateimage,delay);
</script>
</body>
</html>

dumbblonde
12-03-2006, 10:21 PM
Thanks for your reply. I did what you requested and added the script to the designated site on GeoCities but again, all it did was give me a blank box on the site. Please help! I'm lost.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum