父窗口獲取iframe子頁面的title

1.JS實現父窗口獲取iframe的title

var mainFrame=document.getElementById('main-frame');

mainFrame.contentWindow.document.title;//iframe中子頁面的title



2.jquery實現父窗口獲取iframe的title


var $mainFrame=$('#main-frame');

$mainFrame.contents().attr("title");

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章