473,657 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass values between parent and popup window

1 New Member
hi,

I am writing a small java script code where , when the textbox is clicked a pop up window is opened . on entering some data in the text area present in pop up window and pressing ''save" button the pop up is closed and the value is put in the text box of parent window. Now the value is getting passed from pop up to parent but from parent to pop up i am unable to pass the value.

the following is the code to pass the value from pop up to parent window:

[HTML]<script type="text/javascript">
function abc()
{
var wind1=null;
var tmp=null;
wind1 = window.open('', 'displayWindow' , 'width=400,heig ht=300,status=n o,toolbar=no,me nubar=no,scroll bars=1');
wind1.document. write("<script> function alert1(f){");
wind1.document. write("var frmdst=f.ta.val ue;");
wind1.document. write("window.o pener.tmp=frmds t;");
wind1.document. write("window.o pener.getValues ();");
wind1.document. write("window.c lose();");
wind1.document. write("}<\/script>");
wind1.document. write("<html><b ody><form action='#' name='myform' action='post'>< TEXTAREA rows='2' cols='20' name='ta'></TEXTAREA><br><I NPUT type='button' value='save' onclick='javasc ript:alert1(thi s.form);'><INPU T type='button' value='cancel' onclick='javasc ript:window.clo se();'></form></body></html>");
}
function getValues()
{
document.forms["source"].elements["srctext"].value = tmp;
}

</script>
<html>
<body>
<form action="#" name="source" method="get">
<input type="text" onclick='abc(); ' name="srctext" value="" />
</form>
<body>
</html>[/HTML]

Please help me out in getting the data from parent to pop up window.
Thanks in advance .
Nov 30 '06 #1
1 19403
acoder
16,027 Recognized Expert Moderator MVP
To pass values from the parent window to the popup window is even simpler. Declare wind1 as a global variable and once you've opened a window using window.open() assigned to wind1, wind1 now contains a reference to the popup window. For example, to access and set the value of the textarea in the popup window:
Expand|Select|Wrap|Line Numbers
  1. wind1.document.forms["myform"].elements["ta"].value = "whatever you want to set it to...";
May 31 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
9244
by: umashd | last post by:
Hi, I am doing a web based project for my graduation. I studied bit of java for backend processesing and javascript for the client. Here is the scenario. In the FORM, I use INPUT TYPE=text VALUE=" " NAME=cat, and a gif next to it. User will click on the icon to get a new window. In the new window, the user selects a value from the pull down menu (created by servlet from back end) and clicks OK. The value is passed back to the
2
1610
by: Marco Antonio Montalvo Durán | last post by:
hi for example, I have a page 'register.aspx' and open a second page 'popup.aspx', what I want to do is to pass the control and values obtained in 'popup.aspx' to 'register.aspx', somebody help!!! thanks
1
11566
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
5
4598
by: Peter | last post by:
1) I have a C# web application and what I am trying to do is create a popup window from a link on the parent window 2) the popup window will have a button and when a user clicks on the button the program should update a database, close the window and refresh the parent window. My question is does anyone have a example of popup window wich will close it's self and refresh the parent window when a user clicks on a button? I know there are...
0
1078
by: Peter | last post by:
Does any one has an example of how do I retrieve values from a PopUp Window. The popup windows is an ASP.NET webform and it is displayed when user clicks on a html button. How do I retrieve the values from the popup window into the parent window (I would like to do something with the data after the OK button is clicked on the popup window) Here's the code for popup. OpenPopUp(someWebContol, "MyPopup.aspx?textbox=" +...
3
4061
by: Aaron | last post by:
I am having a little difficulty with a relatively simple task. I have a parent webform. I have a javascript attribute added to a button to open a new window when clicked. The user fills in a textbox then clicks the button and on page load the child window should grab that val run a query an present the results. Given that I am bouncing between server side controls and client script. I am just having a little trouble passing my textbox...
1
1751
by: kebabkongen | last post by:
Hi, I am working on an application where I make a popup window with a long list of users (with checkboxes) I am trying to figure out how to pass the list of selected users to the parent window. I have seen this be done by one field, such as "date pickers" from a calendar popup. Can anyone please give me a pointer to how I place the parameters from the popup window in the parent window?
1
1507
by: czuvich | last post by:
I am working in ASP.NET 1.1 and I was wondering if it was possible to have two different windows pass information between each other by the click of say a button. In other words, let's say I have Window A and Window B. A is the main application and opens a popup window called B. I then have a button in B that needs to pass control back to Window A with some data in the URL and then close itself. Is this possible? If so.. how?
1
9357
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then the new page is open in the same popup window as i need to open the new page in the main page window with passing the two textbox parameters into the new page. Program opens the new page but dont know how to pass the two textboxes values into the new page name deceasedToday.asp Needs help in...
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.