Home > Web Front-end > JS Tutorial > How to achieve web page skin change effect

How to achieve web page skin change effect

一个新手
Release: 2017-09-27 09:45:26
Original
2824 people have browsed it


Web page skin change effect

Simple skin change
Blue Red Green

<!DOCTYPE html><html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script>

            function changeColor(str){
                var body = document.getElementById("b");
                body.style.backgroundColor = str;
            }        </script>
    </head>
    <body id="b" >

        <button onclick="changeColor(&#39;blue&#39;)">蓝色</button>
        <button onclick="changeColor(&#39;red&#39;)">红色</button>
        <button onclick="changeColor(&#39;green&#39;)">绿色</button>

    </body></html>
Copy after login

The above is the detailed content of How to achieve web page skin change effect. For more information, please follow other related articles on the PHP Chinese website!

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