开发者

How to set parent window values to child window?

How to set parent window values to child window?

In parent window i have few textboxes. When i enter some values and click on button i need to get those values in child window. I am using HTML and javascript. I need this in javascript or jquer开发者_开发知识库y. Please help me. Thanks in advance.


In your parent window, you should have a function:

//parent window
function getParentValue(){
  return $("#textbox").val();
}

You can call this function in your child window:

//child window

var parentValue = window.opener.getParentValue();
alert(parentValue);

This works because functions are public by default (not like vars)

Hope this helps. Cheers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜