/ Published in: JavaScript
URL: http://www.rodsdot.com/ee/scriptingRemoteImages.asp
Expand |
Embed | Plain Text
<html> <head> <script type="text/javascript"> <!-- function getImage(pExistingImageID, pImageURL){ var img = document.createElement('img'); img.onload = function (evt) { document.getElementById(pExistingImageID).src=this.src; document.getElementById(pExistingImageID).width=this.width; document.getElementById(pExistingImageID).height=this.height; } img.src = pImageURL; return false; } //--> </script> <title>Remote Image 5</title> </head> <body> <p><a href="#" onclick="return getImage('placeHolder','/images/rdivilbiss.jpg');">Get Remote Image</a></p> <p><img id="placeHolder" border="0" src="/images/placeHolder.jpg"></p> </body> </html>
Comments
Subscribe to comments
You need to login to post a comment.

I am the author.
The link to the page has moved to http://www.rodsdot.com/javascript/Remote-Scripting-Images-%28No-Need-For-AJAX%29.asp.
While the central storage location for scripts and code has many merits, the use of my code does require attribution per the Terms Of Used posted at my site.
Users of this site are strongly encouraged to visit the original code to obtain the latest version with any bug fixes, security enhancements, or improvements.