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
Release: 2016-06-24 11:39:57
Original
931 people have browsed it

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>
Copy after login

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.
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template