?
Solved

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

Posted on 2002-04-09
10
Medium Priority
?
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 200 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

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

762 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