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

How to achieve web page skin change effect

一个新手
一个新手Original
2017-09-27 09:45:262823browse


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>

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!

Statement:
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