<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 //設置文檔標題等價于HTML的<title>標簽
    document.bgColor //設置頁面背景色
    document.fgColor //設置前景色(文本顏色)
    document.linkColor //未點擊過的鏈接顏色
    document.alinkColor //激活鏈接(焦點在此鏈接上)的顏色
    document.vlinkColor //已點擊過的鏈接顏色
    document.URL //設置URL屬性從而在同一窗口打開另一網頁
    document.fileCreatedDate //文件建立日期,只讀屬性
    document.fileModifiedDate //文件修改日期,只讀屬性
    document.fileSize //文件大小,只讀屬性
    document.cookie //設置和讀出cookie
    document.charset //設置字符集 簡體中文:gb2312
    ---------------------------------------------------------------------

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

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

    a)通過集合引用
    document.images //對應頁面上的<img>標簽
    document.images.length //對應頁面上<img>標簽的個數
    document.images[0] //第1個<img>標簽
    document.images[i] //第i-1個<img>標簽

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

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

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

    <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 //對應頁面上的<form>標簽
    document.forms.length //對應頁面上<form>標簽的個數
    document.forms[0] //第1個<form>標簽
    document.forms[i] //第i-1個<form>標簽
    document.forms[i].length //第i-1個<form>中的控件數
    document.forms[i].elements[j] //第i-1個<form>中第j-1個控件

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

    -----------------------------------------------------------------------
    <html>
    <!--Text控件相關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控件相關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項
    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項并且判斷某個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">
    //根據SelectedIndex打印出選中的option
    //(0到document.Myform.oSelect.length-1)
    i=document.Myform.oSelect.selectedIndex
    document.write(document.Myform.oSelect[i].value)
    </script>

    <script language="javascript">
    //動態增加select控件的option項
    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="" //圖層設置為可視
    document.all.oDiv.style.display="none" //圖層設置為隱藏
    /*document.all表示document中所有對象的集合
    只有ie支持此屬性,因此也用來判斷瀏覽器的種類*/
    posted on 2006-12-12 10:52 navy 閱讀(141) 評論(0)  編輯  收藏 所屬分類: JavaScript

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


    網站導航:
     
    主站蜘蛛池模板: 国产精品无码免费专区午夜| 亚洲天堂2016| EEUSS影院WWW在线观看免费| 国产特级淫片免费看| 亚洲AV永久无码天堂影院| 波多野结衣久久高清免费| 亚洲国产一区二区三区在线观看| 国内免费高清在线观看| 一本色道久久88亚洲精品综合 | 中文字幕免费在线看线人 | 亚洲日韩亚洲另类激情文学| 亚洲免费在线视频播放| 亚洲福利一区二区| 一二三四免费观看在线电影| 亚洲日本成本人观看| 国产真人无遮挡作爱免费视频| 国产精品亚洲а∨无码播放不卡| 日韩亚洲精品福利| 免费久久人人爽人人爽av| 亚洲色图在线观看| 毛片大全免费观看| 无人视频免费观看免费视频| 国产成人亚洲精品影院| 最近免费mv在线观看动漫| 久久久久亚洲AV无码观看| 毛片免费全部播放一级| 黄网站色视频免费观看45分钟| 亚洲色欲久久久综合网东京热 | 四虎影视www四虎免费| 国产成人亚洲综合a∨| 亚洲精品无码精品mV在线观看| 91免费国产精品| 亚洲中文无码亚洲人成影院| 亚洲精品WWW久久久久久| 国产精品免费看久久久| 亚洲精品123区在线观看| 亚洲中文字幕无码爆乳av中文| 99re免费在线视频| 亚洲国产成人久久综合| 亚洲欧洲成人精品香蕉网| 永久免费av无码网站韩国毛片|