PDA

View Full Version : Help adding hyperlink to existing slideshow



carriehoff
09-02-2005, 05:31 PM
Hello all,

I was hoping you could help me with this script. It loads a pic with a text description, but I've been trying to add a hyperlink for either the pic or the text, or both, to no avail.
Could you take a look and advise, please?
As you can see, I've used ASP to populate the java arrays - I tried to set that code apart in blue. I have also disabled the buttons - I'd rather have it play automatically.
Any help is appreciated.
Thanks,
Carrie

<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_LinkName").innerHTML = g_ImageTable[g_iimg][2];
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;
Next();
}
else
{
getobject("btnPrev").disabled = getobject("btnNext").disabled = false;

}
}
function OnImgLoad()
{
if (g_fPlayMode)
window.setTimeout("Tick()", g_dwTimeOutSec*1500);
}
function Tick()
{
if (g_fPlayMode)
Next();
}
function Prev()
{
ChangeImage(false);
}
function Next()
{
ChangeImage(true);
}

////configure below variables/////////////////////////////

<% Dim rndMax
rndMax = CInt(RS.RecordCount)
'response.write rndMax & "<br>"
RS.MoveFirst

''''''''''''''Pull Random Records
Dim imgArr(6,5)
For i = 0 to 5
Randomize Timer
Dim rndNumber
rndNumber = Int(RND * rndMax)
'response.write rndNumber & "<br>"
RS.Move rndNumber
If RS.EOF then
RS.MoveFirst
RS.Move rndNumber
End If
'response.write i
imgArr(i,0) = RS("Property_ID")
imgArr(i,1) = RS("Bedrooms")
imgArr(i,2) = RS("Baths")
imgArr(i,3) = RS("Address")
imgArr(i,4) = RS("City") %>
//generate the next lines for pics
g_ImageTable[g_imax++] = new Array ("pics/<%=imgArr(i,0)%>l-1.jpg", "<%=imgArr(i,3)%>, <%=imgArr(i,4)%>");
//finish asp loop
Next %>
g_dwTimeOutSec=2

////End configuration/////////////////////////////

if (document.getElementById||document.all)
window.onload=Play

</script>

<p align="center"><img id="_Ath_Slide" onload="OnImgLoad()"></a> </p>

<p align="center"><a href="details.asp?ID=<% response.write imgArr(0,0)%>"><SPAN id="_Ath_FileName"> </SPAN></a><br>
</p>

carriehoff
09-06-2005, 12:31 PM
Does anybody know what I can do to add a hyperlink to this script?

Carrie

jscheuer1
09-06-2005, 02:15 PM
I wrote my own (http://home.comcast.net/~jscheuer1/side/files/johnslidedemo14.htm), become a beta tester!