Heya..
I am not the best with javascript..
so I need a lil' help..
What I want to do is:
Select a set of items from a database.
Present them to the visitor, so the visitor can scroll through these items by clicking a next, or previous button
When they see an item they like.. click the image itself and go to the page with more info.
The database retrieval and scrolling of images functionality is done..
The issue I am having is linking the URL with the image..
How do I pair an image with a URL in the script and present it correctly on the page?
I am thinking multidimensional array.. (yes?)
Any help - most appreciated
Here is what I have for the scrolling...
<SCRIPT LANGUAGE="JavaScript">
<!--
var NumberOfImages = 10
var img = new Array(NumberOfImages)
img[0] = "item10.jpg"
img[1] = "item1.jpg"
img[2] = "item2.jpg"
img[3] = "item3.jpg"
img[4] = "item4.jpg"
img[5] = "item5.jpg"
img[6] = "item6.jpg"
img[7] = "item7.jpg"
img[8] = "item8.jpg"
img[9] = "item9.jpg"
var imgNumber = 0
function NextImage()
{
imgNumber++
if (imgNumber == NumberOfImages)
imgNumber = 0
document.images["itemImage"].src = img[imgNumber]
}
function PreviousImage()
{
imgNumber--
if (imgNumber < 0)
imgNumber = NumberOfImages - 1
document.images["itemImage"].src = img[imgNumber]
}
//-->
</SCRIPT>
<TABLE BORDER=0>
<TR>
<TD COLSPAN=1 ALIGN=MIDDLE>
<A HREF="javascript:PreviousImage()">
[img]reverse.gif[/img]</A>
</TD>
<TD COLSPAN=2 ALIGN=MIDDLE>
[img]item1.jpg[/img]
</TD>
<TD>
<A HREF="javascript:NextImage()">
[img]forward.gif[/img]</A>
</TD>
</TR>
</TABLE>
Submit Your Article
Forum Rules

Reply With Quote
