1 functionPreview (file) {2 varPrevdiv = document.getElementById (' preview ');3 if(file.files && file.files[0]) {4 //support for most browsers, google, firefox, 360, Open Gate IE10.5 varReader =NewFileReader ();6 //when the picture is loaded and finished to memory7 //$ (function () {}) ==> window.onload= function () {}8Reader.onload =function(evt) {9prevdiv.innerhtml = ' ;Ten } oneReader.readasdataurl (file.files[0]); a}Else { - //support for browsers below IE9 -prevdiv.innerhtml = ' <div class= ' img "style=" filter:progid:DXImageTransform.Microsoft.AlphaImageLoader ( Sizingmethod=scale,src=\ " the+ file.value + ' ></div> '; - } -}
<label> Modify Picture:</label>
<div class= "lf salebd" id= "preview"><a href= "#" >/images/ad20.jpg" "width=" height= "/></a></div>"
<input name= "auctionpic" type= "file" class= "offset10 lf" onchange= "preview (this)" />
Select a local image code on the JSP page display