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

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

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

    posts - 0,  comments - 0,  trackbacks - 0
    1、對象屬性
    document.title //設(shè)置文檔標(biāo)題等價于HTML的<title>標(biāo)簽
    document.bgColor //設(shè)置頁面背景色
    document.fgColor //設(shè)置前景色(文本顏色)
    document.linkColor //未點(diǎn)擊過的鏈接顏色
    document.alinkColor //激活鏈接(焦點(diǎn)在此鏈接上)的顏色
    document.vlinkColor //已點(diǎn)擊過的鏈接顏色
    document.URL //設(shè)置URL屬性從而在同一窗口打開另一網(wǎng)頁
    document.fileCreatedDate //文件建立日期,只讀屬性
    document.fileModifiedDate //文件修改日期,只讀屬性
    document.fileSize //文件大小,只讀屬性
    document.cookie //設(shè)置和讀出cookie
    document.charset //設(shè)置字符集 簡體中文:gb2312
    ---------------------------------------------------------------------

    2、對象方法
    document.write() //動態(tài)向頁面寫入內(nèi)容
    document.createElement(Tag) //創(chuàng)建一個html標(biāo)簽對象
    document.getElementById(ID) //獲得指定ID值的對象
    document.getElementsByName(Name) //獲得指定Name值的對象
    ---------------------------------------------------------------------

    3、images集合(頁面中的圖象)

    a)通過集合引用
    document.images //對應(yīng)頁面上的<img>標(biāo)簽
    document.images.length //對應(yīng)頁面上<img>標(biāo)簽的個數(shù)
    document.images[0] //第1個<img>標(biāo)簽
    document.images[i] //第i-1個<img>標(biāo)簽

    b)通過nane屬性直接引用
    <img name="oImage">
    document.images.oImage //document.images.name屬性

    c)引用圖片的src屬性
    document.images.oImage.src //document.images.name屬性.src

    d)創(chuàng)建一個圖象
    var oImage
    oImage = new Image()
    document.images.oImage.src="/1.jpg"
    同時在頁面上建立一個<img>標(biāo)簽與之對應(yīng)就可以顯示

    <html>
    <img name=oImage>
    <script language="javascript">
    var oImage
    oImage = new Image()
    document.images.oImage.src="/1.jpg"
    </script>
    </html>

    ----------------------------------------------------------------------

    4、forms集合(頁面中的表單)

    a)通過集合引用
    document.forms //對應(yīng)頁面上的<form>標(biāo)簽
    document.forms.length //對應(yīng)頁面上<form>標(biāo)簽的個數(shù)
    document.forms[0] //第1個<form>標(biāo)簽
    document.forms[i] //第i-1個<form>標(biāo)簽
    document.forms[i].length //第i-1個<form>中的控件數(shù)
    document.forms[i].elements[j] //第i-1個<form>中第j-1個控件

    b)通過標(biāo)簽name屬性直接引用
    <form name="Myform"><input name="myctrl"></form>
    document.Myform.myctrl //document.表單名.控件名

    -----------------------------------------------------------------------
    <html>
    <!--Text控件相關(guān)Script-->
    <form name="Myform">
    <input type="text" name="oText">
    <input type="password" name="oPswd">
    <form>
    <script language="javascript">
    //獲取文本密碼框的值
    document.write(document.Myform.oText.value)
    document.write(document.Myform.oPswd.value)
    </script>
    </html>
    -----------------------------------------------------------------------

    <html>
    <!--Select控件相關(guān)Script-->
    <form name="Myform">
    <select name="oSelect">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </form>

    <script language="javascript">
    //遍歷select控件的option項(xiàng)
    var length
    length=document.Myform.oSelect.length
    for(i=0;i<length;i++)
    document.write(document.Myform.oSelect[i].value)
    </script>

    <script language="javascript">
    //遍歷option項(xiàng)并且判斷某個option是否被選中
    for(i=0;i<document.Myform.oSelect.length;i++){
    if(document.Myform.oSelect[i].selected!=true)
    document.write(document.Myform.oSelect[i].value)
    else
    document.write("<font color=red>"+document.Myform.oSelect[i].value+"</font>")
    }
    </script>

    <script language="javascript">
    //根據(jù)SelectedIndex打印出選中的option
    //(0到document.Myform.oSelect.length-1)
    i=document.Myform.oSelect.selectedIndex
    document.write(document.Myform.oSelect[i].value)
    </script>

    <script language="javascript">
    //動態(tài)增加select控件的option項(xiàng)
    var oOption = document.createElement("OPTION");
    oOption.text="4";
    oOption.value="4";
    document.Myform.oSelect.add(oOption);
    </script>
    <html>
    -----------------------------------------------------------------------

    <Div id="oDiv">Text</Div>
    document.all.oDiv //引用圖層oDiv
    document.all.oDiv.style
    document.all.oDiv.style.display="" //圖層設(shè)置為可視
    document.all.oDiv.style.display="none" //圖層設(shè)置為隱藏
    /*document.all表示document中所有對象的集合
    只有ie支持此屬性,因此也用來判斷瀏覽器的種類*/
    posted on 2006-12-12 10:52 navy 閱讀(141) 評論(0)  編輯  收藏 所屬分類: JavaScript

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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 最近免费中文字幕大全视频 | 亚洲综合色区在线观看| 日韩一区二区在线免费观看 | 亚洲成年看片在线观看| 国产亚洲精品a在线观看| 亚洲AV一宅男色影视| 亚洲一区二区电影| 中文字幕乱码亚洲精品一区| 无码精品人妻一区二区三区免费| 中文字幕乱码系列免费| 一色屋成人免费精品网站| 亚洲国产一区二区视频网站| 亚洲国产人成网站在线电影动漫| 亚洲一区中文字幕在线观看| 免费很黄无遮挡的视频毛片| 人妻无码一区二区三区免费| 国内一级一级毛片a免费| 亚洲AV无码欧洲AV无码网站| 日韩成人免费视频| 国产成人无码免费视频97| 亚洲∧v久久久无码精品| 成人婷婷网色偷偷亚洲男人的天堂 | 日本免费中文字幕| 亚洲国产精品成人精品小说| 一区二区视频免费观看| 日美韩电影免费看| 人妖系列免费网站观看| 亚洲精品成人无码中文毛片不卡| 亚洲AV无码一区二区三区鸳鸯影院 | 亚洲天堂免费在线视频| 最近2019中文字幕mv免费看| 亚洲AV无码一区二区三区久久精品| 99久久久国产精品免费牛牛| 亚洲av无码久久忘忧草| 免费夜色污私人影院在线观看| 久久久国产亚洲精品| 免费无遮挡无码永久在线观看视频| 亚洲特级aaaaaa毛片| 久久久久久AV无码免费网站下载| 亚洲精品美女久久久久99小说| a成人毛片免费观看|