Set Image source with base64 - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

Set Image source with base64

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//  w w  w  .j a  v a2  s  .co  m
document.getElementById("img").src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
    }

      </script> 
   </head> 
   <body> 
      <img id="img" src="">  
   </body>
</html>

Related Tutorials