web學習日記4

來源:互聯網
上載者:User

標籤:style   blog   io   ar   color   sp   for   on   div   

DOM:

1.事件冒泡:事件最開始由最具體的元素接收然後逐級向上傳播至最不具體的那個點。
   事件捕獲:不太具體的節點應更早地接收到事件,最具體的事件最晚接收到事件。

    IE:事件冒泡流      Firefox:事件捕獲流

2.事件處理常式:

  HTML事件處理常式:直接加在標籤裡。缺點:HTML與JS代碼緊緊地結合在一起。

  DOM0級事件處理常式:把一個函數賦值給一個事件處理常式屬性。優點:簡單跨瀏覽器。

  DOM2級事件處理常式:兩個函數:addEventListener(事件類型,事件處理函數,true/false),removeEventListener(事件,事件處理函數,true/false)。(這裡的事件不加on)。

  IE事件處理常式:attachEvent(事件類型,事件處理函數);detachEvent(事件類型,事件處理函數)。(這裡的事件類型加on)。

  跨瀏覽器的事件處理常式,只要依靠能力檢測判斷採用類型。

 

CSS:

1.權值規則,標籤權值為1,類選擇符權值10;ID選擇符權值為100,!important放在分號前邊,具有最高權值。

2.底線:text-decoration:undeiline;刪除線:text-decoration:line-through;縮排:text-indent:2em;行間距:line-height:5em;

  字母間距:letter-spacing:50px;單詞間距:word-spacing:10px;

 

JS:

由於Js只有在元素節點前插入的標籤,我們可以創造在元素節點後插入的函數。

1 function insertAfter(newElement, targetElement) {2     var parent = parent= target。Element。parentNode;3     if (parent.lsastChild) {4         parent.aooendChild(newElement)5     } else {6         parent.insertBefore(newElement,targetElement。nextSibing);7     }    8 }

 

web學習日記4

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.