This Program Ilustrate a Html Parent Page & Child Page return values from popup to the parent page, when you click a Parent Click Button In A Parent.html, The Child.html page will popped up, Enter any value in the Text Box in the Child.html, then click Child click button, the value entered in the textbox(child.html) will be passed to the textbox(parent.html).
Parent.html
~~~~~~~~~
<html>
Parent.html
~~~~~~~~~
<html>
<head>
<script language="javascript">
function test()
{
var FrmChild = window.showModalDialog('child.html',null,'status:off;center:yes;scroll:no;');
if(FrmChild != null)
{
document.getElementById('Ptxt').value = FrmChild;
}
else
{
return false;
}
}
</script>
<head>
<body>
<input type="text" id='Ptxt'/> <input type="button" onclick="test();" value="Call Child Window" />
</body>
</html>
Child.html
~~~~~~~
<html>
<head>
<script language="javascript">
function Child()
{
var Str = document.getElementById('ctxt').value; window.returnValue = Str;
window.close();
}
</script>
<head>
<body>
Enter Any Value To Pass To The Parent Window<br />
<input type="text" id='ctxt' />
<input type="button" onclick="Child();" value=" Child Click" /> </body>
</html>
Program Demo
Note : IE Supported
No comments:
Post a Comment