老师,请检查

来源:4-10 自由编程

慕盖茨9092533

2020-02-24 12:12:27

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>编程练习</title>

<style type="text/css">

.red{

background: red;

}

</style>

</head>

<body>

<button>添加</button>

<ul>

<li>111</li>

<li>222</li>

<li>333</li>

<li>444</li>

</ul>

<script type="text/javascript" src="js/zepto.min.js"></script>

<script type="text/javascript">

$(document).ready(function(){

var msg = 444;

$("button").click(function(){

$("ul").append("<li></li>");

$("li:last-child").text(msg+=111);

});

$("ul").delegate("li","mouseover",function(){

$(this).addClass("red");

})

.delegate("li","mouseout",function(){

$(this).removeClass("red");

});

})

</script>

</body>

</html>


写回答

1回答

好帮手慕糖

2020-02-24

同学你好,代码是正确的,继续加油。祝学习愉快~

0

0 学习 · 3299 问题

查看课程