p469275 Posted December 10, 2007 Share Posted December 10, 2007 Hi friends, I have a simple HTML form with two elements, one is <input type ="file" ...>field and another is <img>. My requirement is to show the image as soon as i browse and choose a file. Please revert back to me ASAP. Ajoy Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 10, 2007 Share Posted December 10, 2007 <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()"> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.