Reputation: 25
I have some code that properly changes an image based on which text the mouse hovers over. The page is here: http://www.acethelogicgames.com/javatest.html
If you hover over Facebook, the image turns into the facebook logo, and if you hover over Twitter, the image turns into the twitter logo. That part works fine.
My question is, how can I make the image contain a link to facebook.com when the Facebook logo appears, and make the image contain a link to twitter.com when the Twitter logo appears?
Thanks for any help you can provide!
Upvotes: 2
Views: 4691
Reputation: 2424
function change(menuId, image, newImage, newUrl)
{
var img = document.getElementById(image);
img.src = newImage;
document.getElementById('d3').href = newUrl;
}
Upvotes: 1
Reputation: 351
I see that at the moment it's opening Facebook regardless what icon is on.
It seems you're updating only image source in javascript. You should update both image source and image reference at the same time.
Upvotes: 0