Java Script小技巧【對象,屬性】

來源:互聯網
上載者:User

如果你找的javascript的東西的話,建議你 ctrl+F  直接在這個頁上找,因為這裡80%有你要找的,但是要讓你挨著看的話,你就準備看完就去配眼鏡!!

  •  

    • 事件來源對象
      event.srcElement.tagName
      event.srcElement.type
    • 捕獲釋放
      event.srcElement.setCapture(); 
      event.srcElement.releaseCapture(); 
    • 事件按鍵
      event.keyCode
      event.shiftKey
      event.altKey
      event.ctrlKey
    • 事件傳回值
      event.returnValue
    • 滑鼠位置
      event.x
      event.y
    • 表單使用中的元素
      document.activeElement
    • 綁定事件
      document.captureEvents(Event.KEYDOWN);
    • 訪問表單元素
      document.all("txt").focus();
      document.all("txt").select();
    • 表單命令
      document.execCommand
    • 表單COOKIE
      document.cookie
    • 菜單事件
      document.oncontextmenu
    • 建立元素
      document.createElement("SPAN"); 
    • 根據滑鼠獲得元素:
      document.elementFromPoint(event.x,event.y).tagName=="TD
      document.elementFromPoint(event.x,event.y).appendChild(ms) 
    • 表單圖片
      document.images[索引]
    • 表單事件綁定
      document.onmousedown=scrollwindow;
    • 元素
      document.表單.elements[索引]
    • 對象綁定事件
      document.all.xxx.detachEvent('onclick',a);
    • 外掛程式數目
      navigator.plugins
    • 取變數類型
      typeof($js_libpath) == "undefined"
    • 下拉框
      下拉框.options[索引]
      下拉框.options.length
    • 尋找對象
      document.getElementsByName("r1");
      document.getElementById(id);
    • 定時
      timer=setInterval('scrollwindow()',delay);
      clearInterval(timer);
    • UNCODE編碼
      escape() ,unescape
    • 父物件
      obj.parentElement(dhtml)
      obj.parentNode(dom)
    • 交換表的行
      TableID.moveRow(2,1)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.