Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Linking an image within javascript

Posted on 2013-05-27
8
Medium Priority
?
213 Views
Last Modified: 2013-05-28
I've attached a page with code which links to an external site.  The link appears as a date.  I would like to add a gif image to that link.  I'm having some difficulty including an image within the javascript.   Please advise.test.htm
0
Comment
Question by:ddantes
  • 4
  • 3
8 Comments
 
LVL 9

Expert Comment

by:skipper68
ID: 39199880
What is the url to the image?
0
 
LVL 9

Expert Comment

by:skipper68
ID: 39199881
Sorry, maybe I didn't understand your question...
     Are you trying to make the date an image?
     Are you trying to make the URL go to an image?
0
 

Author Comment

by:ddantes
ID: 39199891
Thank you for your reply.  I would like my own image to replace the date.  I don't want to change the link target, just the appearance of the link.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Assisted Solution

by:skipper68
skipper68 earned 500 total points
ID: 39199975
You could try this:
document.write("<a href=\""+theImages[whichImage]+"\" target=\"_blank\"><img src=\""+theImages[whichImage]+"\" \/><\/a>");
0
 

Author Comment

by:ddantes
ID: 39199987
Thank you.  Unfortunately, due to lack of expertise, I don't know how to implement your instructions.  Below is the existing code.  Would you mind inserting the code you provided where it belongs, and I will test it?


<!-- BEGIN DigiCert Site Seal Code -->
<center><div id="digicertsitesealcode" style="width: 81px; margin: 5px auto 5px auto;"></div></center>
<script language="javascript" type="text/javascript"
src="https://www.digicert.com/custsupport/sealtable.php?order_id=00259924&seal_type=a&seal_size=large&seal_color=blue&new=1">
</script>

<script language="javascript" type="text/javascript">coderz();</script>
<!-- END DigiCert Site Seal Code -->
0
 
LVL 9

Accepted Solution

by:
Sar1973 earned 500 total points
ID: 39202017
You can change the link of the image by using document.getElementById("IMGname/ID").src=(image URL).
0
 

Author Comment

by:ddantes
ID: 39202869
Thank you.  Would you mind showing me where that code needs to be inserted, with respect to the code shown in my previous comment?
0
 

Author Comment

by:ddantes
ID: 39203499
It turns out that the image, appearing as a date, is generated by javascript on a remote server.  It's apparently not subject to having my own image substituted.  Thanks to both experts for responding.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question