/    Sign up×
Community /Pin to ProfileBookmark

Problem with image links

I’m having a problem assigning links to each images

Please advice Novice JS writer ?

[CODE]

<script language=”javascript”>
function RotateImages(whichHolder,Start)
{
var a = eval(“ImageArr”+whichHolder);
var b = eval(“ImageHolder”+whichHolder);
var c = eval(“LinkArr”+whichHolder);
var d = eval(“LinkHolder”+whichHolder);
if(Start>=a.length)
Start=0;
b.src = a[Start];
d.href= c[Start];
window.setTimeout(“RotateImages(“+whichHolder+”,”+(Start+1)+”)”,1500);
}
</script>
[/CODE]

[CODE]<a href=”javascript:RotateImages()”> <img scr=”images/may.jpg” name=”Rotating” id=”Rotating1″ width=100 height=100></a>
<hr />
<a href=”javascript:RotateImages()”> <img scr=”images/rsz_prebait_world.png” name=”Rotating” id=”Rotating2″ width=100 height=100> </a>

<script language=”JavaScript”>
var ImageArr1 = new Array(“images/logo_flymen.png”,”images/rsz_prebait_world.png”,”images/logo_flymen.png”);
var ImageHolder1 = document.getElementById(‘Rotating1’);
var LinkArr1 = new Array(<a id=”Link1″ href=”http://www.youtube.com”>,<a id=”Link2″ href=”http://www.hotmail.com”>,<a id=”Link3″ href=”http://www.hotmail.com”>);
var LinkHolder1= document.getElementById(‘Link1’);

var ImageArr2 = new Array(“images/may.jpg”,”images/mefish.jpg”,”images/rsz_prebait_world.png”);
var ImageHolder2 = document.getElementById(‘Rotating2’);
var LinkArr2 = new Array(<a id=”Link4″ href=”http://www.youtube.com”>,<a id=”Link5″ href=”http://www.youtube.com”>,<a id=”Link6″ href=”http://www.youtube.com”>);
var LinkHolder2= document.getElementById(‘Link1’);

RotateImages(1,0);
RotateImages(2,0);
</script>[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorApr 04.2011 — Ouch. Pretty medieval way of coding. Can you tell us in words what do you want to do? When clicking an image, its attributes (src, etc) should change from a list? Which attributes? Be more descriptive please. There is for sure a simple solve, just tell us exactly what you need.
Copy linkTweet thisAlerts:
@MASPauthorApr 04.2011 — Ouch. Pretty medieval way of coding. Can you tell us in words what do you want to do? When clicking an image, its attributes (src, etc) should change from a list? Which attributes? Be more descriptive please. There is for sure a simple solve, just tell us exactly what you need.[/QUOTE]

I want each picture to have its matching link if you could show me please

Sorry about the medieval way of coding but i'm only started last month so hopefully i'll evolve to the Industrial Age soon ?
×

Success!

Help @MASP 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.6,
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,
)...