Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a Image With a Hyperlink Using Only Javascript

Status
Not open for further replies.

Krus1972

Programmer
Joined
Mar 18, 2004
Messages
145
Location
US
We have the following HTML code to use a image as a hyperlink:

<A href="myurl"><img src="mysrc"></a>

If we wanted to do this routine in ASP we would use:
<% Response.write ("<A href="myurl"><img src="mysrc"></a>")
%>

Instead of using PLAIN html or ASP we would like to do this SAME task using only javascript. We understand that the html will have to be included within a sort of javascript print string. The purpose is we do not want search engine bots to pick up on this image but allow the search engines to read the other images on the same webpage. When normal visiotrs view the page the browser will read the javascript and display the image withg link properly. Search engines bots cannot understand javascript and normal browsers can. If someone can help us with a javascript routine to do the SAME task as the plain HTML we would appreciate it. Can anyone help?

Thanks,

Jeff
 
This is just a thought...and js might do it, but im not too good with JS.

if you did something like using the REFERER address to decide weather or not to display images.

Something like
Code:
<%
referVar = http_referrer
siteVar = [URL unfurl="true"]www.mysite.com[/URL]

if referVar = siteVar then response.write(""<A href="myurl"><img src="mysrc"></a>")

But then again, im not sure how search engines read pages but I am pretty sure they can't read ASP code.

<A href="<img src=" border=0></a>
 
Nope It HAS to be in JAVASCRIPT not ASP.

Thanks,

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top