2-4请老师过目

来源:2-4 编程练习

qq_鸭绿桥第一帅哥_0

2019-02-09 21:29:09

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>习题</title>
    <style type="text/css">
    div {
        width: 200px;
        height: 200px;
        border: 1px solid red;
        text-align: center;
        line-height: 200px;
    }
    </style>
</head>

<body>
    <div>背景颜色为白色</div>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>    
    <script>
    //此处写代码
       $('div').mousedown(function(){
        $(this).css('background','red')
               .text('背景颜色为红色');
       });
       $('div').mouseup(function(){
        $(this).css('background','yellow')
               .text('背景颜色为黄色');
       })
    </script>
</body>
</html>


写回答

1回答

好帮手慕糖

2019-02-11

同学你好,效果实现没有问题,继续加油。

祝学习愉快!


0

0 学习 · 36712 问题

查看课程