Solved

Linking an image within javascript

Posted on 2013-05-27
8
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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

632 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