code_junkie

IMG SRC tags and JavaScript

Nov 11th, 2011
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <IMG SRC="GetImage()" />
  2.  
  3. <script language="javascript">
  4. function GetImage() {return "imageName/imagePath.jpg"}
  5. </script>
  6.  
  7. <img src="blank.png" id="image" alt="just nothing">
  8. <script type="text/javascript">
  9. document.getElementById('image').src = "yourpicture.png";
  10. </script>
  11.  
  12. <img src="javascript:GetImage()" />
  13.  
  14. function getImageUrl(img) {
  15. var imageSrc = "imageName/imagePath.jpg";
  16. if(img.src != imageSrc) { // don't get stuck in an endless loop
  17. img.src = imageSrc;
  18. }
  19. }
  20.  
  21. <img src="http://yourdomain.com/images/empty.gif" onload="getImageUrl(this)" />
  22.  
  23. <img src="provideImage.aspx?someparameter=x" />
  24.  
  25. <img src="" id="myImage"/>
  26. <script type="text/javascript">
  27. document.getElementById("myImage").src = GetImage();
  28. </script>
  29.  
  30. <img src='blah' onerror="this.src='url to image'">
  31.  
  32. <a href="http://daily-photo.net"><img src="http://daily-photo.net/index.php/2011/02/02" width="200" class="size-full wp-image-1077" /></a>
  33.  
  34. <img src='images/test.jpg' onmouseover="alert(this.src);">
Add Comment
Please, Sign In to add comment