|
I found an "Interactive image slideshow with text description" and I am using it on a project. The slideshow works great. I was hoping I could allow the image that is rotating to be hyperlinked. A different link for each image. I added the onmouseover event to the image to give it the hand icon. Where can I add the code to put seperate links for each image? I would love if I could put it after the current array data where the image src and text description is done. To run the code replace the images with your own. Any help is appreciated. Below is the code:
<html>
<head>
<title>Dynamic Drive DHTML Scripts- Interactive image slideshow with text description</title>
</head>
<body>
<table border="0" width="100%" id="table1" cellspacing="0" style="border-width: 0px" cellpadding="0">
<tr>
<td colspan="3" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #000000">
<p align="center"><img id="_Ath_Slide" onload="OnImgLoad()" onmouseover="this.style.cursor='hand';"></td>
</tr>
<tr>
<td width="856" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #000000"></b> <SPAN id="_Ath_FileName"></SPAN></td>
<td valign="middle" width="9%" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #000000">
<p align="center"><input name="reverse" id="reverse" onclick="Prev()" type="image" value="dummy" src="/forum/reverse.gif" width="15" height="20" alt="" border="0">
<input name="pause" id="pause" onclick="Play()" type="image" value="dummy" src="/forum/pause_on.gif" width="15" height="20" alt="" border="0">
<input name="forward" id="forward" onclick="Next()" type="image" value="dummy" src="/forum/forward.gif" width="15" height="20" alt="" border="0"></td>
<td width="4%" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px solid #000000">
<p align="center"><SPAN id="_Ath_Img_X"></SPAN>/<SPAN id="_Ath_Img_N"></SPAN></td>
</tr>
</table>
<script language="JavaScript1.2">
/*
Interactive Image slideshow with text description
By Christian Carlessi Salvadó (cocolinks@c.net.gt). Keep this notice intact.
Visit http://www.dynamicdrive.com for script
*/
g_fPlayMode = 0;
g_iimg = -1;
g_imax = 0;
g_ImageTable = new Array();
function ChangeImage(fFwd)
{
if (fFwd)
{
if (++g_iimg==g_imax)
g_iimg=0;
}
else
{
if (g_iimg==0)
g_iimg=g_imax;
g_iimg--;
}
Update();
}
function getobject(obj){
if (document.getElementById)
return document.getElementById(obj)
else if (document.all)
return document.all[obj]
}
function Update(){
getobject("_Ath_Slide").src = g_ImageTable[g_iimg][0];
getobject("_Ath_FileName").innerHTML = g_ImageTable[g_iimg][1];
getobject("_Ath_Img_X").innerHTML = g_iimg + 1;
getobject("_Ath_Img_N").innerHTML = g_imax;
}
function Play()
{
g_fPlayMode = !g_fPlayMode;
if (g_fPlayMode)
{
// getobject("btnPrev").disabled = getobject("btnNext").disabled = true;
reverse.src = "/forum/reverse.gif"
forward.src = "/forum/forward.gif"
pause.src = "/forum/pause_on.gif"
Next();
}
else
{
// getobject("btnPrev").disabled = getobject("btnNext").disabled = false;
reverse.src = "/forum/reverse_on.gif"
forward.src = "/forum/forward_on.gif"
pause.src = "/forum/pause.gif"
}
}
function OnImgLoad()
{
if (g_fPlayMode)
window.setTimeout("Tick()", g_dwTimeOutSec*1000);
}
function Tick()
{
if (g_fPlayMode)
Next();
}
function Prev()
{
ChangeImage(false);
}
function Next()
{
ChangeImage(true);
}
////configure below variables/////////////////////////////
//configure the below images and description to your own.
g_ImageTable[g_imax++] = new Array ("/forum/1.gif", "Test 1234 <a href='http://www.microsoft.com'>read more</a>","http://this_is_where_I_would_like_to_put_link.com");
g_ImageTable[g_imax++] = new Array ("/forum/2.gif", "Test 5678 <a href='http://www.firstfederal.com'>read more</a>");
g_ImageTable[g_imax++] = new Array ("/forum/3.gif", "Test 0000 <a href='http://www.walmart.com'>read more</a>");
g_ImageTable[g_imax++] = new Array ("/forum/4.gif", "Test 2222 <a href='http://www.costco.com'>read more</a>");
g_ImageTable[g_imax++] = new Array ("/forum/5.gif", "Test 4444 <a href='http://www.bp.com'>read more</a>");
//extend the above list as desired
g_dwTimeOutSec=2
////End configuration/////////////////////////////
if (document.getElementById||document.all)
window.onload=Play
</script>
</body>
</html>
|
|
|
|
|
|
|
|