JavaScript preview upload Image found problem resolution _ image effects

Source: Internet
Author: User
Let's look at the effect chart first:

The opportunity is rare, a bit of technology bright spot, suddenly put into function development to go. In this piece of function development, oneself still learn some good things, one of them is, the user chooses to upload the picture, how to preview it out. On the Internet to find some information, the final use of the following methods:
Copy Code code as follows:

function (obj) {//logo Upload Add Event
var logoimg = null;
if (document.all) {//If IE is the case
Obj.select ();
Logoimg = Document.selection.createRange (). text;
Because the filter is the way, so to set the picture is not visible, in the picture outside the Div set filter effect
$ (". 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 the Ie6,ie7,ie8,fox, oh there is a special to the tangled 360 are normal display
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.