总结

html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Titletitle>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">script>
    <script>
        $(document).ready(function () {
           $("#btn1").click(function () {
               $("span").append("
如来佛祖
"
);/*要是在开头追加的话用:prepend()*/ }) ; $("#btn2").click(function () { $("ol").append("
  • 和琪我爱你
  • "
    ); }); $("button").click(function () { /* $("#div1").remove();移除div元素*/ /* $("#div1").empty();清空div元素*/ $("p").remove(".into");/*移除所有 class="italic" 的 p 元素*/ }); $("#haha").click(function () { $("h1,p,span").addClass("red"); $("div").addClass("important"); /* $("h1,h2,p").removeClass("blue");从元素中移除*/ /*$("h1,h2,p").toggleClass("blue");切换改变*/ }); /* var txt=""; txt+="div 宽度: " + $("#div1").width() + "
    ";
    txt+="div 高度: " + $("#div1").height() + "
    ";
    txt+="div 宽度,包含内边距: " + $("#div1").innerWidth() + "
    ";
    txt+="div 高度,包含内边距: " + $("#div1").innerHeight(); $("#div1").html(txt);显示尺寸*/ }); script> <style> .important{ font-weight: bold; font-size: xx-large; } .red{ color:red; } style> head> <body> <span>他是谁?span> <ol> <li>和琪大傻瓜1li> <li>和琪大傻瓜2li> <li>和琪大傻瓜3li> ol> <button id="btn1">她是:button> <button id="btn2">追加一句:button> <div id="div1" style="height: 300px;margin-left:200px;width: 300px;border: 1px solid blanchedalmond;background-color: burlywood;"> <p>花自飘零水自流p> <p>更那堪冷落清秋节p> <p>花自飘零水自流p> <p class="into">等闲变却故人心,却道故人心易变p> div> <button>删除div元素button> <h1>标题1h1> <p>你好啊p> <span>我就是老大span> <div>这很重要div> <button id="haha">改变button> body> html>

    你可能感兴趣的:(总结)