运行代码 缩小
喵记
HTML代码
复制 格式化 注释 注释 清空
放大
AخA
 
1
<!DOCTYPE html>
2
<html>
3
    <head>
4
        <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
5
        <script type="text/javascript" src="//apps.bdimg.com/libs/jquery/1.11.3/jquery.min.js"></script>
6
    </head>
7
    <body>
8
        <p>
9
            <span id = "s1">我爱你</span>
10
        <input type = "button" id = "btn1" value = "在后面插入擦拉黑" />
11
        <input type = "button" id = "btn2" value = "在前面插入loveyou" />
12
        <input type = "button" id = "btn3" value = "插入文字aaa" />
13
        <input type = "button" id = "btn4" value = "插入文字bbb" />
14
        </p>
15
        <p>
16
            <span id = "s2">我也爱你</span>
17
        <input type = "button" id = "btn5" value = "替换成么么哒" />
18
        </p>
19
        
20
        <h4>喵记</h4>
21
        <h4>小缪</h4>
22
        <h4>虫子</h4>
23
        <input type = "button" id = "btn6" value = "替换成阿文,并变大" />
24
        <input type = "button" id = "btn7" value = "文字不变,变大" />
25
        <input type = "button" id = "btn8" value = "删掉喵记下面的" />
26
    </body>
27
</html>
CSS代码
复制 格式化 注释 注释 颜色 清空
放大
x
 
1
body {
2
    background-image: url(/themes/zhan/styles/images/bg-body.jpg);
3
}
4
.main {
5
    width: 80%;
6
    margin: auto;
7
    text-align: center;
8
    border: 1px solid #e0e0e0;
9
    box-shadow: 0 0 2px #ddd;
10
    word-wrap: break-word;
11
    padding: 10px;
12
    border-radius: 3px
13
}
14
JS代码
复制 格式化 注释 注释 清空
放大
xxxxxxxxxx
37
 
1
$(document).ready(function(){
2
    $("#btn1").click(function(){
3
        $("#s1").append("擦拉黑");
4
    });
5
   $("#btn2").click(function(){
6
    $("#s1").prepend("love you");
7
   });
8
  $("#btn3").click(function(){
9
   $("#s1").before("aaa");
10
  });
11
  $("#btn4").click(function(){
12
   $("#s1").after("bbb");
13
  });
14
  
15
  $("#btn5").click(function(){
名称
9.6dom操作
分类
jQuery实例
描述
插入元素,替换元素,删除元素
收藏