473,395 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Communication between browser windows?



I need guidance on implementing the following functionality in
javascript:

User clicks on a link (or button) in browser window A that brings
up a separate browser popup window B featuring a list/table of 500+
clickable items; clicking on any one of these items causes it (or
rather its label string) to be added to the contents of a textarea
field in the original page A, perhaps after checking that it has
not been added already.

The document in window B must somehow know about the document in
window A, and the script must behave appropriately (i.e. do nothing)
if the document in window A disappears for some reason (e.g. user's
navigation, window closing, etc.) and the user clicks on an item
in window B.

Any advice on implementing this would be much appreciated.

TIA,

jill
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.

Jul 23 '05 #1
2 2760
J Krugman wrote:
I need guidance on implementing the following functionality in
javascript:

User clicks on a link (or button) in browser window A that brings
up a separate browser popup window B featuring a list/table of 500+
clickable items; clicking on any one of these items causes it (or
rather its label string) to be added to the contents of a textarea
field in the original page A, perhaps after checking that it has
not been added already.

The document in window B must somehow know about the document in
window A, and the script must behave appropriately (i.e. do nothing)
if the document in window A disappears for some reason (e.g. user's
navigation, window closing, etc.) and the user clicks on an item
in window B.
if(opener){ //window A is available }}

or better yet, look for a known object in window A.

if(opener.document.forms["formName"].elements["elementName"])

Mick
Any advice on implementing this would be much appreciated.

TIA,

jill

Jul 23 '05 #2
J Krugman wrote:
I need guidance on implementing the following functionality in
javascript:

User clicks on a link (or button) in browser window A that brings
up a separate browser popup window B featuring a list/table of 500+
clickable items; clicking on any one of these items causes it (or
rather its label string) to be added to the contents of a textarea
field in the original page A, perhaps after checking that it has
not been added already.

The document in window B must somehow know about the document in
window A, and the script must behave appropriately (i.e. do nothing)
if the document in window A disappears for some reason (e.g. user's
navigation, window closing, etc.) and the user clicks on an item
in window B.

Any advice on implementing this would be much appreciated.


In the "onclick" event handler of the triggering element in browser
window A call window.open(). You may want to cancel the event by
returning `false' to the handler. In the "onchange" event handler of
the triggering "select" element or (better) in the "onclick" event
handler of the triggering "add" button in window B, read the value
or text of the currently selected item and append it to the "value"
property of the (HTML)TextArea(Element) object in the Window referenced
by the "opener" property of the current Window/global object, possibly
delimited with newline ("\n"). You need to check if "opener" is a valid
object reference and if it has not been closed and if has such an
(HTML)TextArea(Element) object before.

Checking that the value has not been added already is somewhat difficult
as you need to find a way to tell one entry from the other, perhaps
using Regular Expression matching. Probably a (HTML)Select(Element)
object would do better than a (HTML)TextArea(Element) object. How you
add options to a "select" element should be in the FAQ or available via
Google Groups search. You could instead disable the currently selected
option in window B after its value/text has been added to the "textarea"
element in window A but I doubt this can be implemented cross-browser.

Don't forget to provide a server-side alternative for users who have
no client-side script support available.
HTH

PointedEars
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Harald Massa | last post by:
Hello, I have a group of Python programms which I want to teach to "talk to each other". All run on Windows, on the same computer or in the same intranet. Security of communication is not an...
7
by: Dan V. | last post by:
Situation: I have to connect with my Windows 2000 server using VS.NET 2003 and C# and connect to a remote Linux server at another company's office and query their XML file. Their file may be...
3
by: Tim Reynolds | last post by:
I support a .Net application running on a SERVER accessing MF Db2 data. Occasionally, we have some type of connection problem that we have been unable to debug up to this point. We typically...
4
by: Vidya Bhagwath | last post by:
Hello Experts, I am porting the C++ code into the Visual C#.NET. My C++ code is mainly based on the serial communication. So I am using the windows structure such as DCB.. etc and the windows...
11
by: Jochen Neyens | last post by:
We're in the process of developing an e-commerce application that vets can use to order medicines. One of the requirements is that the web application can communicate with a locally installed...
21
by: dast | last post by:
Hi, I'm having trouble letting my background thread tell my main thread what to do. I'm trying to tell my main thread to open a form, but when my background thread ends, the form that I...
2
by: ne.seri | last post by:
In short, I'm building a kind of server which is supposed to handle open connections with clients. E.g. client connects to the server, the connection stays open, client sends a request to the...
3
by: =?Utf-8?B?U2VraGFy?= | last post by:
Hi All I have a requirement where the user clicks a button on the windows app. A browser pops up. User enters some data in the browser. And I want the data sent back to the windows app. How do i...
5
by: AeonOfTime | last post by:
Let's assume a web application (in this case a browser-based game) with a custom HTTP server built on PHP, and a client also built on PHP. The client uses the server to access and change data. Even...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.