Solved

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

Posted on 2002-04-09
10
259 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
Comment Utility
from the child:

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

Expert Comment

by:knightEknight
Comment Utility
oops ... try this:

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

Expert Comment

by:knightEknight
Comment Utility
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
 
LVL 1

Author Comment

by:mail2yogi1
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:mail2yogi1
Comment Utility
Hey noboday knows to use createElement().........

Its very Urgent ....
Yogi
0
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
what is the error?
0
 
LVL 1

Author Comment

by:mail2yogi1
Comment Utility
Dear knightEknight  Thanks.
0
 
LVL 33

Accepted Solution

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

Author Comment

by:mail2yogi1
Comment Utility
Thanks, knightEknight for helping in time.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now