Jump to content

Dynamically showing image upon selection a file from local pc, in HTML form


p469275

how to dynamically show the image in HTML form?  

  1. 1. how to dynamically show the image in HTML form?

    • 1
      0
    • 2
      0


Recommended Posts

<script language="javascript">
function viewpic()
{
var getfile = document.getElementById('pics').value;
document.getElementById('viewer').src='file:///'+getfile+'';
}
function imageloaded()
{
document.getElementById('viewer').style.display='block';
document.getElementById('viewer').style.width='300px';
document.getElementById('viewer').style.height='250px';
}
</script>

<img id="viewer" src="" style="display:none" onload="imageloaded()"><br><br>

<input type="file" id="pics" onblur="viewpic()">

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.