2-4作业
来源:2-4 编程练习
挪威_
2020-01-22 16:26:34
<!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").mouseup(function () {
$(this).css({"background": "yellow"}).html("背景颜色为黄色")
});
$("div").mousedown(function () {
$(this).css({"background": "red"}).html("背景颜色为红色")
});
})
</script>
</body>
</html>
1回答
好帮手慕言
2020-01-22
同学你好,效果是正确的,继续加油,祝学习愉快~