重點注意:若chrome不能執行,請用IE
方法一:單純傳值法
母:
function openWindow(){
window.open('upload.html','mywindow','width=400,height=200');
}
子:
function backToParent(){
//opener(母視窗)的form1的輸入值 = 目前網頁(子視窗)form2輸入的值
opener.document.form1.textInput.value = document.form2.input.value;
window.close();
}
方法二:呼叫母視窗的某個方法,並帶參數
母:
function action4(){
window.open('popupView.html','PopupView', config='height=350,width=350');
//document.getElementById("myText").value = window.returnValue;
}
function actionFather(Value){
//alert("Value")
var Value = Value;
}
子:
function action5(){
window.opener.actionFather("haha"); //呼叫父視窗的actionFather方法,並把值傳過去給他
window.close();
}
沒有留言:
張貼留言