Solved

how to use createElement(); In child window for opener window?

Posted on 2002-04-09
10
262 Views
Last Modified: 2008-03-06
Dear Friends,
I have one dropdown list box in parent window. I want to
insert options into that from child window.  
I am using window.open() for opening child window.
I can able do it in parent window with
/********************************************
xx = document.createElement("OPTION");
xx.text="yogi"
xx.value="yogi"
document.frmName.listName.add(xx);
/********************************************

But Please Tell me how it is posibile from child window?
I tried with opener.createElement("OPTION"); It is not allowing..........

IN SHORT
 how to use createElement(); In child window for opener
window?
0
Comment
Question by:mail2yogi1
  • 5
  • 4
10 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 6928401
from the child:

opener.document.frmName.listName.add(xx);
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 6928405
oops ... try this:

if ( self.opener && !self.opener.closed )
  self.opener.document.frmName.listName.add(xx);
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 6928417
and if that doesn't work, then do this ...

first, give the parent window a name, so in the parent window, do this:

<BODY onLoad='self.name="theParent";'>


then in the child, do this:


if ( !self.opener )
   self.opener = window.open("","theParent");  // get handle to parent

if ( self.opener && !self.opener.closed )
   self.opener.document.frmName.listName.add(xx);
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:mail2yogi1
ID: 6928427
Actually I am dynamically creating dropdown list box in parent window. and in child window I want to add elements in to it. So I must have to use createElement function.

So How to use it. This is same question as above. In other way.
Thanks,
0
 
LVL 12

Expert Comment

by:ahosang
ID: 6928437
In parent write the function:
<script>
function adder(t, v) {
  xx = document.createElement("OPTION");
  xx.text=t;
  xx.value=v;
  document.frmName.listName.add(xx);
}
</script>

In child call this:

opener.adder("yogi", "yogi");
0
 
LVL 1

Author Comment

by:mail2yogi1
ID: 6930318
Hey noboday knows to use createElement().........

Its very Urgent ....
Yogi
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 6931067
what is the error?
0
 
LVL 1

Author Comment

by:mail2yogi1
ID: 6931370
Dear knightEknight  Thanks.
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 50 total points
ID: 6931405
what error message are you seeing?
0
 
LVL 1

Author Comment

by:mail2yogi1
ID: 6933980
Thanks, knightEknight for helping in time.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question