Javascript web page black/white effect implementation code (compatible with IE/FF, etc.) _ javascript skills

Source: Internet
Author: User
Today, I saw a good method recommended by someone on the Internet. After a try, the effect is still acceptable. You can customize a part of the webpage to become a gray color (black and white ). The demo address below is partial gray

Partial gray demo address: http://demo.jb51.net/js/grayscale/index.html
Full gray demo address: http://demo.jb51.net/js/grayscale/demo2.htm
Usage:

1. first introduce the grayscale. js file to the webpage.
2. Execute the grayscale function.

Sample Code:

The Code is as follows:


Grayscale (document. body); // the entire site turns gray
Grayscale (document. getElementById ("main"); // The specified element is dimmed.
Grayscale. reset (document. getElementById ("main"); // restore a specified Element


Package

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.