/    Sign up×
Community /Pin to ProfileBookmark

create hyperlink in following .js script

Hi everybody.

I have a question.

I am working on a simple slide show. But in the current script it is not possible to hyperlink each image. And to be honest, I’m not a developer that is clever enough te create that.

Here you will find the complete javascript. Is there anyone who can help me how to hyperlink each image? (…when the image is loaded, that you can click on it to get a new page)

Thnx a lot in advance…

<script language=”JavaScript1.2″>

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;
Next();
}
else
{
getobject(“btnPrev”).disabled = getobject(“btnNext”).disabled = false;

}
}
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 (“small/1.jpg”, “1”);
g_ImageTable[g_imax++] = new Array (“small/2.jpg”, “2”);
g_ImageTable[g_imax++] = new Array (“small/3.jpg”, “3”);
g_ImageTable[g_imax++] = new Array (“small/4.jpg”, “4”);
g_ImageTable[g_imax++] = new Array (“small/5.jpg”, “5”);
g_ImageTable[g_imax++] = new Array (“small/6.jpg”, “6”);
g_ImageTable[g_imax++] = new Array (“small/7.jpg”, “7”);
g_ImageTable[g_imax++] = new Array (“small/8.jpg”, “8”);
g_ImageTable[g_imax++] = new Array (“small/9.jpg”, “9”);
g_ImageTable[g_imax++] = new Array (“small/10.jpg”, “10”);
g_ImageTable[g_imax++] = new Array (“small/11.jpg”, “11”);
g_ImageTable[g_imax++] = new Array (“small/12.jpg”, “12”);
g_ImageTable[g_imax++] = new Array (“small/13.jpg”, “13”);
g_ImageTable[g_imax++] = new Array (“small/14.jpg”, “14”);
g_ImageTable[g_imax++] = new Array (“small/15.jpg”, “15”);
g_ImageTable[g_imax++] = new Array (“small/16.jpg”, “16”);
g_ImageTable[g_imax++] = new Array (“small/17.jpg”, “17”);
g_ImageTable[g_imax++] = new Array (“small/18.jpg”, “18”);
g_ImageTable[g_imax++] = new Array (“small/19.jpg”, “19”);
g_ImageTable[g_imax++] = new Array (“small/20.jpg”, “20”);
g_ImageTable[g_imax++] = new Array (“small/21.jpg”, “21”);
g_ImageTable[g_imax++] = new Array (“small/22.jpg”, “22”);
g_ImageTable[g_imax++] = new Array (“small/23.jpg”, “23”);
g_ImageTable[g_imax++] = new Array (“small/24.jpg”, “24”);
g_ImageTable[g_imax++] = new Array (“small/25.jpg”, “25”);
g_ImageTable[g_imax++] = new Array (“small/26.jpg”, “26”);
g_ImageTable[g_imax++] = new Array (“small/27.jpg”, “27”);
g_ImageTable[g_imax++] = new Array (“small/28.jpg”, “28”);
g_ImageTable[g_imax++] = new Array (“small/29.jpg”, “29”);
g_ImageTable[g_imax++] = new Array (“small/30.jpg”, “30”);
g_ImageTable[g_imax++] = new Array (“small/31.jpg”, “31”);
g_ImageTable[g_imax++] = new Array (“small/32.jpg”, “32”);
//extend the above list as desired
g_dwTimeOutSec=5

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

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

</script>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Warren86Nov 22.2004 — <HTML>

<Head>

<Script Language=JavaScript>

var inUseFlag = false;

var nPix = 5;

var currImg = 1;

var isLink = new Array()

isLink[1] = "1.html" // link for 1.jpg, etc.

isLink[2] = "2.html"

isLink[3] = "3.html"

isLink[4] = "4.html"

isLink[5] = "5.html"


function control(direction){

if (direction == 'fwd')
{
if (currImg == nPix){currImg = 1}
else{currImg++}
}
if (direction == 'back')
{
if (currImg == 1){currImg = nPix}
else{currImg--}
}
slideImg.src = "small/"+currImg+".jpg";
}


function runShow(){

if (inUseFlag == false)
{
play.style.visibility = "hidden";
back.style.visibility = "hidden";
fwd.style.visibility = "hidden";
}
inUseFlag = true;
currImg++;
slideImg.src = "small/"+currImg+".jpg"
if (currImg < nPix+1){setTimeout('runShow()',1000)}
else {
slideImg.src = "small/1.jpg"
play.style.visibility = "visible"
back.style.visibility = "visible";
fwd.style.visibility = "visible";
inUseFlag = false;
currImg = 1;
}

}

function gotoLink(){

window.location = isLink[currImg];
}

</script>

</head>

<Body>

<Table align='center'>

<TR>

<TD colspan=3 align=center>

<img src='small/1.jpg' id='slideImg' width=400 height=300 onclick="gotoLink()" alt='Click for more info'>

</TD>

</TR>

<TR>

<TD align='center'>

<input type=button value=' < ' id='back' onClick="control('back')">

</TD>

<Td align='center'>

<input type=button value=' Start ' id='play' onClick="runShow()">

</TD>

<TD align='center'>

<input type=button value=' > ' id='fwd' onClick="control('fwd')">

</TD>

</TR>

</Table>

</Body>

</HTML>
Copy linkTweet thisAlerts:
@knertauthorNov 22.2004 — Thnx!!

Unfortenately it's not the same script, so the layout structure is different.
Copy linkTweet thisAlerts:
@Warren86Nov 22.2004 — It was offered as a SUBSTITUTE for the original code, maybe that wasn't obvious. But hey, if you are emotionally attached to the original, then I wish you well.
×

Success!

Help @knert spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...