作业

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<div id="aDiv" style="width: 100px;height: 100px;background-color: yellow;"></div>
<button id="aBtn">点击变色</button>
<script>
    $('#aBtn').click(function () {
            $("#aDiv").css("background-color","red");
        });
</script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<div id="bDiv" style="width: 100px;height: 100px;background-color: red;">
    <p>p标签</p>
</div>
<button id="bBtn">点击改变内容</button>
<script>
    $('#bBtn').click(function () {
        $("#bDiv p").text("我是子元素");
    });
</script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<div id="cDiv" style="width: 100px;height: 100px;">
    <p>p标签</p>
    <p style="background-color: red;">p标签</p>
    <p>p标签</p>
</div>
<button id="cBtn">点击改变第二个p标签背景</button>
<script>
    $('#cBtn').click(function () {
        $("#cDiv p:eq(1)").css("background-color","orange");
    });
</script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<ul>
    <li>AAA</li>
    <li>BBB</li>
    <li>CCC</li>
</ul>
<script>
       $('#deleteBtn').click(function () {
        $('ul li:last').remove();
    });
</script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<button id="deleteBtn">点我删除最下面的li</button>
<p>弹出下标</p>
<p>弹出下标</p>
<p>弹出下标</p>
<p>弹出下标</p>
<p>弹出下标</p>
<script>
    $('p').on('click',function () {
        alert($(this).index());
    });
</script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">
</head>
<body>
<div id="Box" style="height: 100px;width: 100px;background-color: red;position: absolute;"></div>
<button id="Btn" style="margin-top: 100px;">向右移动按钮</button>
<script src="jQuery/jquery-3.4.1.min.js"></script>
<script>
    $('#Btn').click(function () {
        $('#Box').animate({
                "left":"500px",
            });
    });
</script>
</body>
</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值