Local Image Preview (support for IE6, IE7, IE8, and Firefox3) _ javascript skills

Source: Internet
Author: User
To preview a local image, you can obtain the image path from the file value in IE6 to display the preview. In IE7 and IE8, you can obtain the image path of the file through select, use a filter to display the preview. For FireFox, read this article and hope to help you with your local image preview requirements during Web project development, although I was not able to use it for other reasons, I had some knowledge about it and sorted it out.

Here we divide by browser, mainly including IE6, IE7/8, and Firefox3, excluding Opera, Safari, and Chrome. These three are basically very small and have not been studied.

To sum up:
In IE6, you can directly obtain the image path from the file value to display the preview.
In IE7 and IE8, you can use select to obtain the file image path, and then use a filter to display the preview.
In FireFox, The getAsDataURL method of file is called to obtain Data URI Data to display the preview.

The following is a complete Demo:

The Code is as follows:




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.