JS method to get the image lowsrc property

  • 2020-05-26 07:40:55
  • OfStack

The example in this article shows how JS can get the lowsrc property of a picture. Share with you for your reference. The details are as follows:

The lowsrc attribute 1 is normally set to the low-resolution image address. The following code can be used to display the low-resolution version of the image by clicking the link


<!DOCTYPE html>
<html>
<body>
<img id="compman" src="compman.gif" lowsrc="compman_lowres.gif" 
alt="Computerman" width="107" height="98">
<br>
<script>
var x=document.getElementById("compman");
document.write('<a href="' + x.lowsrc + '">Low resolution</a>');
</script>
</body>
</html>

I hope this article has been helpful to your javascript programming.


Related articles: