<input type="file"> 的取值问题
java中在页面时jsp的<input type="file" style="width:250px" id="upload_image_1" >
我想做个上传图片及时预览的功能,然后在jsp中取出input文本框的路径。
[解决办法]
document.formName.id.value 取值。
[解决办法]
楼主其实Google有大把样例,下面是其中一类,但IE7会有问题,需要特殊处理。
另外,由于涉及到本地文件访问,IE安全控制有时候也会让图片出不来。
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>无标题页</title> <script type="text/javascript"> function Preview(file) { document.getElementById("Test").src = file; } </script></head><body> <form id="form1" runat="server"> <asp:FileUpload ID="FileUpload1" runat="server" /> <img id='Test' src=''></img> </form></body></html>
[解决办法]