老师帮忙看下

来源:2-4 编程练习

weixin_慕斯卡2316274

2019-10-31 15:37:20

<!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>

    //此处写代码

    $(document).ready(function(){

        $('div').mousedown(function(){

            $(this).css({'background':'red'});

        });

        $('div').mouseup(function(){

            $(this).css({'background':'yellow'});

        });

    })

    </script>

</body>

</html>


写回答

1回答

好帮手慕码

2019-10-31

同学你好!
背景颜色改变以后,里面的文字也需要改变,如:

http://img.mukewang.com/climg/5dba8fa409c34f2e08250388.jpg

效果:

http://img.mukewang.com/climg/5dba8fc30950dd5c02280233.jpg

如果帮助到了你,欢迎采纳,祝学习愉快~

0

0 学习 · 36712 问题

查看课程