JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 19th, 2004, 05:54 AM
stevoclark stevoclark is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 stevoclark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How do you make an image hyperlink in js?

I have a webpage that currently links to another website through an image with the example code:

<a href="http://www.website" target="_blank"><img border="2" src="images/example.jpg" alt="example"></a>


My question is this:

How can I make it so that when the user moves the mouse over the image it displays the website address in the status bar *and* when they actually click the image, it goes to the intended website. Basically, everything it would do with the existing HREF tag.

I want to do this to keep the existing link but to stop any Google PR leakage.

Regards, Steve

Reply With Quote
  #2  
Old September 19th, 2004, 07:35 AM
Michael2003 Michael2003 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Dec 2003
Posts: 1,037 Michael2003 User rank is Sergeant (500 - 2000 Reputation Level)Michael2003 User rank is Sergeant (500 - 2000 Reputation Level)Michael2003 User rank is Sergeant (500 - 2000 Reputation Level)Michael2003 User rank is Sergeant (500 - 2000 Reputation Level)Michael2003 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 14 h 20 m 3 sec
Reputation Power: 25
Code:
<img src="" alt="" onclick="location.href='URL';" onmouseover="window.status='LINK';" onmouseout="window.status='';" />

I think that is what you are after, but there should be a better way of doing it. You don't want google to find out the link? Why not have it in a logged in area? Then googlebot won't be able to see it. Javascript isn't really ideal for this sort of thing, and googlebot may be able to follow the link anyway.

Reply With Quote
  #3  
Old September 19th, 2004, 07:55 AM
stevoclark stevoclark is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 stevoclark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK that's great help thanks ..

How do you make it so that the 'hand' appears on mouseover ... as opposed to the default arrow?

This isn't just for Google purposes, it's actually mainly to just look like a normal href link to the human eye.

Steve

Reply With Quote
  #4  
Old September 19th, 2004, 08:10 AM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
Dev Shed God 11th Plane (10000 - 10499 posts)
 
Join Date: Jul 2003
Location: I used to live at home, now I stay at the house
Posts: 10,180 ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)ChiefWigs1982 User rank is General 16th Grade (Above 100000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 5 Days 19 h 54 m 23 sec
Reputation Power: 2037
Code:
<img src="pic.png" onClick="window.location.href='http://forums.devshed.com';" style="cursor:pointer;" border="1" />
__________________
Support requests via PM will be ignored!
Sites: WordPress Metro Theme | Route of Queue
Read These: The General Rules Thread | The General FAQ Thread | NEW USERS - How to post a question


Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > How do you make an image hyperlink in js?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap