Click to See Complete Forum and Search --> : slide show...


Downhill_MTB
06-24-2003, 08:33 AM
Hey, I want to make a slide show that displays more than one image at a time say like 6 at a time, im new to this and cant seem to figure it out, the code below just displays one image at a time, any help would be great thanks.



<SCRIPT LANGUAGE="JavaScript">

var num=1
img1 = new Image ()
img1.src = "information.gif"
img2 = new Image ()
img2.src = "interference.gif"
img3 = new Image ()
img3.src = "message.gif"
img4 = new Image ()
img4.src = "nervous.gif"


function slideshowUp()
{
num=num+1
if (num==5)
{num=1}
document.mypic.src=eval("img"+num+".src")
}

function slideshowBack()
{
num=num-1
if (num==0)
{num=4}
document.mypic.src=eval("img"+num+".src")
}

</SCRIPT>

<!-- The Image Codes are Below -->

<CENTER>
<IMG SRC="information.gif" NAME="mypic" BORDER=0 HEIGHT="100" WIDTH="100">
<p>


<A HREF="JavaScript:slideshowBack()"> Back</A>

<A HREF="JavaScript:slideshowUp()"> Next</A>

Khalid Ali
06-24-2003, 09:06 AM
Take a look at this part of your JS

document.mypic.src=eval("img"+num+".src")

in collaboration with the thi shtml code in yur posted code
<IMG SRC="information.gif" NAME="mypic" BORDER=0 HEIGHT="100" WIDTH="100">

it displays an image...You only need to no use the loop and use a fixed range in the js and you need to add 5 more html img elements.
Once you have as many elements as you want then change the image of all 6 elements using exactly the js line above.

ocument.mypic1.src=eval("img"+num+".src")

ocument.mypic2.src=eval("img"+num+".src")

ocument.mypic3.src=eval("img"+num+".src")

ocument.mypic4.src=eval("img"+num+".src")

ofcourse you can make this code allot more elegant but for starters this should do..:D

requestcode
06-24-2003, 11:14 AM
How about this one:
http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm

There are several others at the above site that might interest you also.