DIV CSS 佈局教程網

jQuery 取得 iframe 的 document 物件的方法
編輯:JQuery特效代碼     

取得 iframe 的 document 物件,主要目的是為了對其進行 DOM 操作。做法相當簡潔:

 $(function() { var result = $('#myframe').prop('contentWindow').document; console.log(result); });

這樣輸出來的結果就是一個 document 物件。透過 prop('contentWindow') 取得 iframe 的內容視窗,再取用其 document,就能進一步選取並操作 iframe 內部的元素了。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved