我的第一个事件!

原创 2018-11-13 17:51:06 170
摘要:<!DOCTYPE html> <html>          <head>         <title>       
<!DOCTYPE html>
<html>
    
    <head>
        <title>
            事件操作的作业
        </title>
        <meta charset="utf-8">
        <script type="text/javascript" src="jquery-3.3.1.js">
        </script>
        <style type="text/css">
            #div1,#div2,#div3{width:150px;height:150px;background-color:#18C7F8;border-radius:10px;line-height:60px}
        </style>
        <script type="text/javascript">
            $(function() {
                $("#div1").mouseover(function() {
                    $(this).css({
                        "background-color": "#F987D1",
                        "border-radius": "75px"
                    });
                })

                $("#div1").mouseleave(function() {
                    $(this).css({
                        "background-color": "#18C7F8",
                        "border-radius": "10px"
                    });
                })

            })
        </script>
    </head>
    
    <body>
        <div id="div1">
        </div>
        <span>
            mouseover/mouseleave
        </span>
    </body>

</html>


批改老师:天蓬老师批改时间:2018-11-13 17:52:31
老师总结:鼠标移入移出事件, 其实还有更简单的实现方法,想想看. 还有,建议将js代码写到页面底部

发布手记

热门词条