add new option item to the select from another frame 
Author Message
 add new option item to the select from another frame

Hi All,

I'd like to add a new item to the select object, that is in the another
frame.
the following command doesn't work from frame2, the frame1 and frame2 are
children frames.

parent.frame1.document.form1.products[parent.frame1.document.form1.products.
options.length] = new Option("111");

Thanks
Barna



Sat, 28 Dec 2002 03:00:00 GMT  
 add new option item to the select from another frame

Hi Barnabas

Q237831 - PRB: Problem Adding New Option to Select Box in Another Frame in
Internet Explorer 5
http://support.microsoft.com/support/kb/articles/Q237/8/31.ASP

Hope this helps.
Klaus

Quote:

> Hi All,

> I'd like to add a new item to the select object, that is in the another frame.

> the following command doesn't work from frame2, the frame1 and frame2 are
> children frames.

> parent.frame1.do
> ument.form1.products[parent.frame1.document.form1.products.options.length] =
> new Option("111");

> Thanks
> Barna



Sat, 28 Dec 2002 03:00:00 GMT  
 add new option item to the select from another frame
To access a window's children try something like...

from "frame1"...

var ParentWin = window.parent;
var Frame2Win = ParentWin.frames.item("frame2");

Frame2Win should then be accessible to script. However, your call to
create a new Option("111") must be called from within "frame2" in
order to create the new element within Frame2's DOM.  So there must be
some function within frame2 that will include the code to create the
new Option. This function can be called from other frames or the
parent Frames Page.

However, it is possible to place script functions in the Frames Page
as well.

you may have a function in the Frames Page like

AddFrame2Option(OptionID)
{
        var Frame2 = window.frames.item("frame2");
        Frame2.AddOption(OptionID);

Quote:
}

or

from frame 1 you may call

var ParentWin = window.parent;
var Frame2Win = ParentWin.frames.item("frame2");

Frame2Win.AddOption(OptionID);

Note:  this is all pseudo-code that I haven't explicitly tested, but
It could lead you in the right direction.

Good Luck,
lws

On Tue, 11 Jul 2000 11:25:32 +0200, "Barnabas Mudri"

Quote:

>Hi All,

>I'd like to add a new item to the select object, that is in the another
>frame.
>the following command doesn't work from frame2, the frame1 and frame2 are
>children frames.

>parent.frame1.document.form1.products[parent.frame1.document.form1.products.
>options.length] = new Option("111");

>Thanks
>Barna


Software Engineer
24/7 Systems, Inc.
www.tf7.com


Sat, 28 Dec 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Prob when adding new OPTION to SELECT

2. Prob when adding new OPTION to SELECT

3. Deleting items from <SELECT>'s options

4. How to select option items programmatically?

5. changing select options based on previously selected options

6. Adding items to a select with Jscrip or vbscript

7. add SELECT item in parent window

8. add option to select list

9. Netscape 6 - adding an option to select

10. Adding options to a select element

11. Add Option string to select control?

12. Add option method to form.select object

 

 
Powered by phpBB® Forum Software