admin管理员组文章数量:1426450
How to pass value from parent to child window field. I use window.open("www.google");
after popwindow is opened i need to pass/set search value typed in parent window to child window(www.google)
How to pass value from parent to child window field. I use window.open("www.google.");
after popwindow is opened i need to pass/set search value typed in parent window to child window(www.google.)
Share Improve this question asked Apr 20, 2010 at 19:47 minilminil 7,15516 gold badges51 silver badges57 bronze badges2 Answers
Reset to default 2Set a reference using the window.open() method:
var childWin = window.open("www.google." <etc.>);
Then treat childWin as a whole other window. For example,
childWin.document.getElementById('searchField')
will give you a reference to an element with ID of "searchField". Etc. Rinse and repeat.
If you want to open a page or window with sending data POST or GET method you can use a code like this:
$.ajax({
type: "get", // or post method, your choice
url: yourFileForInclude.php, // any url in same origin
data: data, // data if you need send some data to page
success: function(msg){
console.log(msg); // for checking
window.open('about:blank').document.body.innerHTML = msg; // you can change about:blank to an url.
}
});
本文标签: javascriptPass a value from Parent to Child (Open) windowStack Overflow
版权声明:本文标题:javascript - Pass a value from Parent to Child (Open) window - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745473285a2659845.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论