JS code for preview image: Copy code The code is as follows: <br> function setImagePreview(docObj,localImagId,imgObjPreview) <br> {<br> if(docObj.files && docObj.files[0])<br> {<br> //Under Firefox, directly set the img attribute<br> imgObjPreview.style.display = 'block';<br> imgObjPreview.style.width = '300px';<br> imgObjPreview.style.height = '200px'; <p> . } <br> else = document.selection.createRange().text;<br><br> //Must set initial size<br> come here Fake images<br> try<br> localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader" ).src = imgSrc;<br> }<br> ");<br> return false;<br> 🎜> }<br> return true; ><br></p> <p>fileupload control and image used to preview pictures: </p> <p></p> <div class="codetitle"> <span><a style="CURSOR: pointer" data="64640" class="copybut" id="copybut64640" onclick="doCopy('code64640')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code64640"> <br><div id="localImag" style="width : 300px; height: 200px"><br> <img id="preview" alt="Preview image" src="http://www.jb51.net/images/logo.gif" width="300px" height="200px" /><br></div><br> <asp:FileUpload ID="PicLoad" Width="300px" runat="server" onchange="javascript:setImagePreview(this,localImag, preview);"><br> </asp:FileUpload> <p> </p> </div> <br>The function is very simple and the code is also very easy to understand. I believe everyone can understand it without me having to talk nonsense. I feel like there’s really not much to say in writing an article like this, so I won’t say much and let’s focus on the code. </div>