2013年4月2日 星期二

取得html標籤中所有內容

From Evernote:

取得html標籤中所有內容

Clipped from: http://www.lslnet.com/linux/f/docs1/i04/big5125741.htm
為了做出另開新視窗,再將父視窗內容複製到子視窗的功能,
之前只會:子視窗名稱.document.body.innerHTML=document.body.innerHTML; 複製body裡面的東西。
在head標籤中的css都沒複製到,後來google到下面這個網址:
http://www.lslnet.com/linux/f/docs1/i04/big5125741.htm
網頁中有以下幾個方法:
d ocument.body.parentNode.innerHTML
d ocument.body.parentElement.innerHTML
d ocument.getElementsByTagName("html")[0].innerHTML
d ocument.all.tags("html")[0].innerHTML
d ocument.documentElement.innerHTML

沒有留言:

張貼留言