Due to security issues, IE7 disabled the image control to reference local images. After several days of being depressed for this problem, I finally found a solution. I want to share some good things with you,CodeAs follows:
This code segment is placed between <Style Type="Text/CSS"># Newpreview{
Filter: progid: DXImageTransform. Microsoft. alphaimageloader (sizingmethod=Scale)
}
</Style>
Code in <body> < Script Language = " Javascript " Type = " Text/JavaScript " >
Function previewimg (imgfile)
{
VaR newpreview = Document. getelementbyid ( " Newpreview " );
Newpreview. Filters. Item ( " DXImageTransform. Microsoft. alphaimageloader " ). SRC = Imgfile. value;
Newpreview. style. Width = " 80px " ;
Newpreview. style. Height = " 60px " ;
}
</ Script >
< ASP: fileupload ID = " Fud_pic " Runat = " Server " Onchange = " Previewimg (this) " />
< Div ID = " Newpreview " > </ Div >
From: http://www.cnblogs.com/RobotTech/archive/2007/09/14/893001.html
My comments: It's been a long time to search, and it's a long JavaScript code. This is simple and easy to use! You can preview the file before uploading.