/    Sign up×
Community /Pin to ProfileBookmark

Hyperlink image change

I have 4 links that use the same image. I need a way to change the image to an alternate when a user hovers over the image. i’ve tried a javasript

function movepic(img_name,img_src) {
document[img_name].src=img_src;

<A HREF=”ktats.htm”
onmouseover=”movepic(‘button’,’fingupsm.gif’)”
onmouseout=”movepic(‘button’,’fingdnsm.GIF’)” style=”text-decoration: none”>
<IMG NAME=”button” SRC=”fingdnsm.GIF” ALT=”Image” border=”0″ align=”left” width=”80″ height=”60″>Tatoos</A>

but when i add another link the pics stay static

Let me know if i should post in other forum or if you can help

Thanks

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsNov 25.2004 — This may be over the top but


[URL]http://homepage.ntlworld.com/vwphillips/ImageRollOverEffects/ImageRollOverEffects.htm[/URL]
Copy linkTweet thisAlerts:
@albohoauthorNov 25.2004 — Thanks I'll give it a try
Copy linkTweet thisAlerts:
@vwphillipsNov 26.2004 — more constructivly

the src of an image can be changed from any link

for example

<image src="fred.gif >

give the image an id

<image id="MyImg" src="fred.gif >


<span onclick="document.getElementById('MyImage').src='Tom.gif;" >Link 1</span>

to change the image from another Link add

<span onclick="document.getElementById('MyImage').src='Dick.gif;" >Link 2</span>

and

<span onclick="document.getElementById('MyImage').src='Harry.gif;" >Link 2</span>

and on and on

there are numerous methods and extensions including the link I posted
×

Success!

Help @alboho 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...