entered value from Parent window to child window

Child to Parent window data transfer



  • Passing data & Managing Parent - Child window


Parent Window code

<html>
<head>
<title>Parent Window here</title>
<script>
function to_open(){
tm=window.open("child.html",'rating',"width=550,
	height=170,left=150,top=200");
}
function to_close(){
tm.close();
}
</script>
</head>
<body>
<h1>Parent Window</h1>
<input type=text name=t1 id=t1 value='plus2net'>
<input type=button value='open child' onClick=to_open()>
<input type=button value='Close child' onClick=to_close()>
<br>
<br>
<form method=post action='' name=f1>
your name <input type=text name='p_name' size=50>
</form>
</body>
</html>

Child window code

To open the child window this is the code used in parent window
<html>
<head>
<title>Parent Window here</title>
<script>
function post_value(){
//window.opener.location.href="parent.html";
opener.document.f1.p_name.value=document.frm.c_name.value;
  self.close();
}

</script>
</head>
<body>
<h1>Child  Window</h1>
<form name=frm method=post action=''>
  Enter your name <input type=text id='c_name' name='c_name'>
<input type=button value='Pass data and Close me'
	onClick=post_value();>
</form>
<script>
document.getElementById('c_name').value=
opener.document.getElementById('t1').value
</script>
</body>
</html>
Passing data from Child to Parent Window
Window object Reference Window refreshing Parent window from Child
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer