| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Aug 2006
Posts: 1
|
Image preview code -- what's wrong?
Let me start out by saying hi to everyone, this is my first post here. I am currently developing some tools for a web page I'm working on, and the code works fine for IE but not so for Firefox. Basically I want to allow the user to upload a picture to the server and show a preview of the image before the file is uploaded. The picture is to be updated when the user chooses the file. Here is the code: <script type="text/JavaScript"> <!-- function updatePreview(id) { var e = document.getElementById(id); document.getElementById("img_preview").src = e.value; } //--> </script> This is inside the <form> </form> Code <input type="file" name="file_src" id="fl_src" onChange="updatePreview('fl_src');" /> This is the image place holder <img src="preview.jpg" id="img_preview" /> Thanks in advance to anyone that can help me out with this. |
|
|
|
![]() |