1. 程式人生 > >iframe——html子頁面呼叫父頁面的方法

iframe——html子頁面呼叫父頁面的方法

$(function() { //在iframe子頁面中查詢父頁面元素 alert($('#default', window.parent.document).html());//在iframe中呼叫父頁面中定義的變數 alert(parent.value);//在iframe中呼叫父頁面中定義的方法 parent.sayhello(); //在iframe中進行跳轉頁面parent.location.href="/home/login";});