It took me two days to figure out how to preview the picture.
Task requirements are as follows: There is a picture on the 1:jsp page (pic_1)
2: Click on the picture to eject the interface similar to the resource manager
3: Preview After selecting a picture at pic_1
I am on the IE8 test the following code, you can achieve the above functions, not in other browsers test, if you friends know a variety of browser support methods, please enlighten, learn together, thank you.
<!
DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
A simple explanation of the code:
Input type= "file" this element I have tried to let the style hide (style= "Display:none"), so that you can not or get an absolute path, but fakepath, in order to not let it show up to let him 100% transparent, Below has a div,id for img_2, this div is the page initial picture, clicks this picture to call the input type= "file" in the method, realizes this function.
Limited capacity, but also please advise, there is a better way please provide me, learn together, thanks.