• 0515JS事件、函数、操作document对象、练习


    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <style type="text/css">
                *{
                    margin: 0 auto;
                    padding: 0;
                }
                body{
                    transition: 1s;
                }
                #first{
                    width: 100px;
                    height: 60px;
                    background-color:#00008B;
                    border-radius: 5px;
                    text-align: center;
                    line-height: 60px;
                    font-size: 22px;
                    color: white;
                }
                #first:hover{
                    cursor: pointer;
                }
                #second{
                    width: 160px;
                    height: 60px;
                    text-align: center;
                    line-height: 60px;
                    font-size: 15px;
                }
                #a1{
                    width: 100px;
                    height: 60px;
                    background-color:#00008B;
                    border-radius: 5px;
                    margin-top: 20px;
                    text-align: center;
                    line-height: 60px;
                    font-size: 22px;
                    display: none;
                    color: white;
                }
                #second:hover{
                    cursor: pointer;
                }
                #third{
                    width: 700px;
                    height: 100px;
                    background-color: #00008B;
                    margin-top: 100px;
                    border-radius: 10px;
                    text-align: center;
                    line-height: 100px;
                    color: white;
                }
                #third:hover{
                    cursor: pointer;
                }
                .four{
                    width: 100px;
                    height: 60px;
                    background-color:#00008B;
                    border-radius: 5px;
                    margin-top: 80px;
                    margin-left: 500px;
                    text-align: center;
                    line-height: 60px;
                    font-size: 22px;
                    color: white;
                    float: left;
                }
                .fifth{
                    width: 100px;
                    height: 60px;
                    background-color:#00008B;
                    border-radius: 5px;
                    margin-top: 80px;
                    margin-left: 500px;
                    text-align: center;
                    line-height: 60px;
                    font-size: 22px;
                    color: white;
                    float: left;
                }
                .fifth:hover{
                    cursor: pointer;
                }
            </style>
        </head>
        <body>
            <div id="first" onclick="first()">
                按钮
            </div>
            <div id="second">
                <input type="checkbox" name="" id="" value="" onmousemove="second()"/>鼠标经过出现按钮
            </div>
            <div id="a1">
                点我
            </div>
            <div id="third">
                鼠标经过这个div变高变色,移除再恢复
            </div>
            <div class="four" onclick="four1()">
                按钮
            </div>
            <div class="four" onclick="four2()" style="margin-left: 80px;">
                按钮
            </div>
            <div class="fifth" onclick="fifth()">
                按钮
            </div>
            <div class="fifth" onclick="fifth()" style="margin-left: 40px;display: none;">
                按钮
            </div>
        </body>
    </html>
    <script type="text/javascript">
        function first(){
            alert("弹出窗口");
        }
        var second = document.getElementById("second");
        second.onmouseover = function(){
            var second1 = document.getElementById("a1");
            second1.style.display = "block";
        }
        second.onmouseout = function(){
            var second1 = document.getElementById("a1");
            second1.style.display = "none";
        }
        var third = document.getElementById("third");
        third.onmouseover = function(){
            third.style.height = "200px";
            third.style.backgroundColor = "red";
            third.style.transition = "3s";
        }
        var third = document.getElementById("third");
        third.onmouseout = function(){
            third.style.height = "100px";
            third.style.backgroundColor = "#00008B";
        }
        function four1(){
            var four3 = document.getElementsByTagName("body")[0];
            four3.style.backgroundColor = "darkmagenta";
            four3.style.transition = "1s";
        }
        function four2(){
            var four3 = document.getElementsByTagName("body")[0];
            four3.style.backgroundColor = "#C69500";
            four3.style.transition = "1s";
        }
        var fifth1 = document.getElementsByClassName("fifth")[1];
        var fifth2 = fifth1.style.display;
        function fifth(){
            if(fifth2 == "none"){
                fifth1.style.display = "block";
                fifth2 = "block";
            }else{
                fifth1.style.display = "none";
                fifth2 = "none";
            }
        }
    </script>
  • 相关阅读:
    C++11 vector使用emplace_back代替push_back
    Centos6.4 编译安装 nginx php
    Centos 编译安装nodejs&express框架
    zookeeper 入门(二)
    zookeeper 入门(一)
    Paxos算法1-算法形成理论[转载]
    yum只下载软件不安装的两种方法
    Centos 6.4 安装dnsmasq
    Centos 6.4 安装erlang&rabbitmq
    Centos 6.4 安装Python 2.7 python-pip
  • 原文地址:https://www.cnblogs.com/mjwwzy/p/9053991.html
Copyright © 2020-2023  润新知