Home > Web Front-end > JS Tutorial > Solution to the problem found in javascript preview of uploaded images_Image special effects

Solution to the problem found in javascript preview of uploaded images_Image special effects

WBOY
Release: 2016-05-16 18:15:21
Original
1365 people have browsed it

Let’s take a look at the renderings first:
Solution to the problem found in javascript preview of uploaded images_Image special effects
This is a rare opportunity and I have some technical highlights, so I immediately invested in functional development. In this aspect of function development, I still learned some good things. One of them is how to preview the pictures that the user chooses to upload. I found some information online and finally adopted the following method:

Copy the code The code is as follows:

function (obj) { //Logo upload add event
var logoimg = null;
if (document.all) {//If it is IE
obj.select();
logoimg = document .selection.createRange().text;
//Since the filter method is used, the image must be set to invisible, and the filter effect is set on the DIV outside the image
$(".setup_logo_left img").removeAttr("src");
$(".setup_logo_left img").css("display", "none");
var img = document.getElementById("preview_fake");
img.filters.item(
'DXImageTransform.Microsoft.AlphaImageLoader').src = logoimg;
return;
}
logoimg = obj.files[0].getAsDataURL();
$(".setup_logo_left img").attr("src", logoimg);
}

The effect is very good, in IE6, IE7, IE8, FOX, oh there is one more The 360 ​​which is particularly confusing is displayed normally.
Related labels:
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