Wednesday 8 February 2012

Parent window field updated by a child popup window

Parent window code


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Passing of value from Child to parent window</title>

<META NAME="DESCRIPTION" CONTENT="Transfering value from Child window to parent window ">

<META NAME="KEYWORDS" CONTENT="Window passing value, parameter value , passing of value, small window closing">

</head>
<body>
     
<h1>entered value from child window to parent window </h1>
  <form method=post action='' name=f1>
  <br>
 <input type=text name='p_name1'  >
<br>
  <a href="javascript:void(0);" NAME="Search Criteria Window" title=" Search Criteria " onClick=window.open('child.jsp',"Ratting",'width=750,height=170,left=150,top=200,toolbar=1,status=1,');>Click here to open the child window</a>
     
  </form>
  <br>
 </body>
</html>

Child page ( child.jsp)



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script langauge="javascript">
function post_value(){
opener.document.f1.p_name1.value = document.frm.c_name1.value;
 self.close();
 opener.test1();
}
</script>
<title>(Type a title for your page here)</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">



</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">

<form name="frm" method=post action=''>
<table border=0 cellpadding=5 cellspacing=5 >
 <tr><td align="center">
 Enter No of rows
</td><td align="center">
 <input type="text"" name="c_name1"  value=3  >
 </td><td align="center">
 <input type=button value='Submit' onclick="post_value();">
  </td></tr>
</table></form>

</body>
</html>

No comments:

Post a Comment