Javascript的一些小知識點

來源:互聯網
上載者:User

小弟五一回家去了,本想好好的享受下五一假期,誰知悲劇的人生不需要解釋。好不容易過五關斬十將,跨千山趟萬水,回到家裡。吃著老媽做的好菜,第二天就莫名其妙的急性腸炎,這肚子鬧騰的。NND,氣死哥了,早知道就不回家了。好了,廢話不多說,進入主題。

================

關於clientHeight、offsetHeight、scrollHeight
window.screen.availWidth 返回當前螢幕寬度(空白空間)
window.screen.availHeight 返回當前螢幕高度(空白空間)
window.screen.width 返回當前螢幕寬度(解析度值)
window.screen.height 返回當前螢幕高度(解析度值)
window.document.body.offsetHeight; 返回當前網頁高度
window.document.body.offsetWidth; 返回當前網頁寬度

=================================

純手工畫圖 不要鄙視 啊


================================

添加HTML內容與常值內容以前用的是innerHTML與innerText方法,
還有insertAdjacentHTML和 insertAdjacentText方法,
這兩個方法更靈活,可以在指定的地方插入html內容和常值內容。
insertAdjacentText方法與 insertAdjacentHTML方法類似,只不過只能插入純文字,參數相同
方法名稱:insertHtml(where,el,html)
參數介紹:
where:插入位置。包括beforeBegin,beforeEnd,afterBegin,afterEnd。
el:用於參照插入位置的html元素對象
html:要插入的html代碼
insertAdjacentHTML 方法:在指定的地方插入html標籤語句
原型:insertAdajcentHTML(swhere,stext)
參數:
swhere: 指定插入html標籤語句的地方,
stext:要插入的內容
有四種值可用:
1. befZ喎?http://www.bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vcmVCZWdpbjogsuXI67W9serHqb+qyrzHsDxicj4KMi4gICAgIGFmdGVyQmVnaW46suXI67W9serHqb+qyryx6rzH1q668zxicj4KMy4gICAgIGJlZm9yZUVuZDqy5cjrtb2x6sepveHK+LHqvMfHsDxicj4KNC4gICAgIGFmdGVyRW5kOrLlyOu1vbHqx6m94cr4seq8x7rzPGJyPgo8L3A+CjxwPj09PT09PT09PT09PT09PT09PT09PT09PaG3v7TPwrT6wuuwyTwvcD4KPHA+PHByZSBjbGFzcz0="brush:java;"> 24.htm insertAdjacentHTML插入新內容 <script> function addsome() { document.all.paral.insertAdjacentHTML("afterBegin"," 在文本前容器插入入內容1"); document.all.paral.insertAdjacentHTML("beforeEnd"," 在文本後容器插入入內容2"); document.all.paral.insertAdjacentHTML("beforeBegin"," 在文本前容器外插入內容4"); document.all.paral.insertAdjacentHTML("afterEnd"," 在文本後容器外插入內容5"); } </script> 原來的內容 OK,先寫到這吧。


聯繫我們

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