Home >Web Front-end >HTML Tutorial >Upload image preview function for IE8 and below_html/css_WEB-ITnose

Upload image preview function for IE8 and below_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:39:57955browse

Function description: You need to preview the image before uploading it
Dashenmen, please give me some advice on how to implement it. I have been working on it for several days


Reply to the discussion ( Solution)

function previewImage(element) {	var src;	element.select();	src = document.selection.createRange().text;	document.getElementById('preview').innerHTML = '<img src="'+ src +'" />';	}<input type="file" name="pic" id="pic" onchange="previewImage(this)" /> <div id="preview"></div>

This method is fine when running locally, but not when running on the server

Upload preview plug-in




Upload preview plug-in



Thank you so much, it’s a pity that it doesn’t work on Safari.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn