Solved

Linking an image within javascript

Posted on 2013-05-27
8
205 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 9

Assisted Solution

by:skipper68
skipper68 earned 125 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 125 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

820 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