<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    wangflood

    精心維護一個技術blog,為了工作,也是愛好。

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      14 Posts :: 19 Stories :: 8 Comments :: 0 Trackbacks
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {
            
    //取得第一個匹配元素的html內容。不能用于xml,但可以用于xhtml
            //alert($("div").html());
            //設置每個元素的 html內容。
            //$("div[id='test2']").html("Hello World");
            $("div").html(function(index, html) {
                
    return html + index;
            });
        });
    </script>
    </head>
    <body>
        
    <div>
            
    <p>Hello</p>
        
    </div>
        
    <div id="test2">中華</div>
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {
            
    //對Html,xml都有效。
            //text()取得所有匹配元素的內容 ,包括子元素。
            //text()<b></b>轉化為實體。
            $("div").text(function(index, text) {
                
    return $("p").text() + text + index + "<b>我靠</b";
            });
        });
    </script>
    </head>
    <body>
        
    <p>
            
    <b>Test</b> Paragraph.
        
    </p>
        
    <p>Paraparagraph</p>
        
    <div>我是div:</div>
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {
            
    //獲得單個select 的值和多選select的值。
            /*
            $("p").append(
                    "<b>Single:</b> " + $("#single").val() + " <b>Multiple:</b> "
                            + $("#multiple").val().join(", "));
            
             
    */

            
    //    alert($("input").val());
            //設置文本框 的值。
            $("input[id]").val("hello World");

            $(
    "#single").val("Single2");
            $(
    "#multiple").val([ "Multiple""Multiple3" ]);
            $(
    "input").val([ "check2""radio1" ]);

            $(
    ":text.items").val(function() {
                
    return this.value + " " + this.className;
            });
        });
    </script>
    </head>
    <body>
        
    <p></p>
        
    <br />
        
    <select id="single">
            
    <option>Single</option>
            
    <option>Single2</option>
        
    </select>
        
    <select id="multiple" multiple="multiple">
            
    <option selected="selected">Multiple</option>
            
    <option>Multiple2</option>
            
    <option selected="selected">Multiple3</option>
        
    </select>

        
    <input type="text" value="some text" />
        
    <input id="test2" type="text" />
        
    <input type="checkbox" value="check1" /> check1
        
    <input type="checkbox" value="check2" /> check2
        
    <input type="radio" value="radio1" /> radio1
        
    <input type="radio" value="radio2" /> radio2

        
    <input type="text" class="items" />
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {

            
    //想把dom文檔中元素副本加到其他元素上時很有用。
            //$("b").clone().prependTo("p");
            //clone(true),深copy
            $("button").click(function() {
                $(
    this).clone(true).insertAfter(this);
            });
        });
    </script>
    </head>
    <body>
        
    <b>Hello</b>
        
    <p>, how are you?</p>
        
    <button>Clone Me!</button>
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {
            
    //alert($("p").css("color"));
            //如果屬性名包含 "-"的話,必須使用引號: 
            /*
             $("p").css({
             color : "#ff0011",
             background : "blue"
             });
             
    */
            
    //$("p").css({ "margin-left": "10px", "background-color": "blue" }); 
            //$("p").css("color", "red");
            $("div").click(function() {
                $(
    this).css({
                    width : 
    function(index, value) {
                        
    return parseFloat(value) * 1.2;
                    },
                    height : 
    function(index, value) {
                        
    return parseFloat(value) * 1.2;
                    },
                    background : 
    "green"
                });
            });

        });
    </script>
    </head>
    <body>
        
    <p>how are you</p>
        
    <div>how</div>
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {

            
    //請確保在 <body> 元素的onload事件中沒有注冊函數,否則不會觸發$(document).ready()事件。

            
    //可以在同一個頁面中無限次地使用$(document).ready()事件。其中注冊的函數會按照(代碼中的)先后順序依次執行。

            
    //獲取匹配元素在當前窗口的相對偏移。top left
            /*var p = $("p:last");
            var offset = p.offset();
            p.html("left: " + offset.left + " ,top " + offset.top);
            p.offset({
                top : 10,
                left : 30
            });
             
    */

            
    //position元素相對于父元素的偏移。只對可見元素有效。
            //$("p:last").html($("p:first").position().left);
            //相對滾動條頂部的偏移。
            //$("p:last").html($("p:first").scrollTop());
            //$("p:first").scrollLeft(300);
            //$("p:last").html($("p:first").height());//19
            //內部區域的高度。
            //$("p:last").html($("p:first").innerHeight());//19
            $("p:last").html($("p:first").outerHeight());//19
        });
    </script>
    </head>
    <body>
        
    <p>Hello</p>
        
    <p>2nd Paragraph</p>

        請確保在 body元素的onload事件中沒有注冊函數,否則不會觸發$(document).ready()事件。

        //可以在同一個頁面中無限次地使用$(document).ready()事件。其中注冊的函數會按照(代碼中的)先后順序依次執行。
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {
            
    //把所有匹配的元素用其他元素的結構化標記包裹起來。
            //<div class="wrap"><p>Test Paragraph.</p></div> 
            //$("p").wrap("<div class='green'></div>");
            //$("p").wrap(document.getElementById("content"));
            /*$("p").wrap(function() {
                return "<div class='green'/>"
            });
             
    */

            
    //$("p").unwrap();
            //將每個匹配元素的子內容包裹起來。
            $("p").wrapInner("<b></b>");
        });
    </script>
    </head>
    <body>
        
    <p>Test Paragraph.</p>
        
    <div id="content" class="green"></div>
        
    <div>
            
    <p>Hello</p>
            
    <p>cruel</p>
            
    <p>World</p>
        
    </div>
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {
            
    //$("p").empty();
            //$("p").remove();//how are 沒刪除
            $("p").remove(".hello");//刪除class="hello"
            //這個方法不會把匹配的元素從jQuery對象中刪除,因而可以在將來再使用這些匹配的元素
            //detach表示游離態。
            $("p").detach();
        });
    </script>
    </head>
    <body>
        
    <p>
            Hello, 
    <span>Person</span> <href="#">and person</a>
        
    </p>
        
    <class="hello">Hello</p>
        how are
        
    <p>you?</p>
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {
            
    //$("p").append("<b>Hello</b>");
            /*
            $("p").append(function(index, html) {
                return html + "   append"
            });
             
    */

            
    //注意之前    <p>I would like to say:</p>這一段就不存在了。
            //$("p").appendTo("div");
            //$("<p/>").appendTo("div").addClass("green").end().addClass("red");
            
            
    //[ <p><b>Hello</b>I would like to say: </p> ] 
            //$("p").prepend("<b>Hello</b>");
        });
    </script>
    </head>
    <body>
        
    <p>I would like to say:</p>
        
    <div></div>
        
    <div></div>
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript" src="lib/jquery-1.5.2.js"></script>
    <style type="text/css">
    .red 
    {
        background-color
    : red;
    }

    .green 
    {
        background
    : green;
    }
    </style>
    <script type="text/javascript">
        $(
    function() {

            
    //$("p").replaceWith("<b>Paragraph</b>")
            $("<b>Paragraph</b>").replaceAll("p");
        });
    </script>
    </head>
    <body>
        
    <p>Hello</p>
        
    <p>cruel</p>
        
    <p>World</p>
    </body>
    </html>
    posted on 2011-04-14 13:00 wangflood 閱讀(1800) 評論(2)  編輯  收藏

    Feedback

    # re: jquey復習(四) 2011-04-14 13:38 孤城網絡
    頂你的。  回復  更多評論
      

    # re: jquery復習(四) 2011-04-22 18:40 wshsdlau
    寫的太多了,你就不會精煉一點嗎?  回復  更多評論
      


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲av高清在线观看一区二区 | 精品免费久久久久久成人影院| 亚洲av永久中文无码精品| 大胆亚洲人体视频| 久久亚洲免费视频| 亚洲中文字幕无码爆乳app| 亚洲av中文无码| 最近免费中文字幕大全高清大全1| 亚洲中文字幕久久精品无码A| 亚洲日本中文字幕天堂网| 99久久国产免费中文无字幕| 亚洲精品乱码久久久久蜜桃| 亚洲精品午夜无码专区| 我的小后妈韩剧在线看免费高清版| 在线观看亚洲专区| 亚洲视频小说图片| 亚洲av高清在线观看一区二区| 精品久久8x国产免费观看| 欧洲美女大片免费播放器视频| 亚洲精品一区二区三区四区乱码 | 一本大道一卡二大卡三卡免费| 色婷婷六月亚洲婷婷丁香| 国产伦一区二区三区免费| 少妇人妻偷人精品免费视频 | 成人性生交大片免费看午夜a| a色毛片免费视频| 亚洲av无码兔费综合| 亚洲网站在线免费观看| gogo全球高清大胆亚洲| 免费观看无遮挡www的小视频| 巨胸喷奶水www永久免费| 精品亚洲成A人无码成A在线观看| 黑人精品videos亚洲人| 免费看男女下面日出水视频| 欧洲乱码伦视频免费| 久久国产精品2020免费m3u8| 一级毛片免费播放男男| 精品亚洲福利一区二区| 中文有码亚洲制服av片| 亚洲春色在线观看| 亚洲毛片在线观看|