473,326 Members | 2,255 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,326 software developers and data experts.

little question

Hi,

I want to know if it's possible from a popup to add Option on a Select
object on the parent, by just calling the Select object like this :

var openerForm = window.top.opener.document.forms[0];
opt = new Option(theLabel, theValue,false,false);
openerForm.mySelect.options[i] = opt;

Or maybe I must use another way by passing the option like a string on an
hidden field an evaluate this string ?

Thanks for your help

Kevin
//--------------------------------------------------
Kevin Auch
MVP .NET
CodeWise Community Member
http://www.dotnet-fr.org
----------------------------------------------------//
Jul 23 '05 #1
1 1105
Kevin Auch wrote:
I want to know if it's possible from a popup to add Option
on a Select object on the parent, by just calling the Select
object like this :

var openerForm = window.top.opener.document.forms[0];
opt = new Option(theLabel, theValue,false,false);
openerForm.mySelect.options[i] = opt;
No it is not.
Or maybe I must use another way by passing the option like a
string on an hidden field an evaluate this string ?
It is generally the rule in javascript that anything that proposes using
the - eval - function is the worst approach available.

The problem is (ultimately) the location in which the memory that your
new Option uses resided. If you use - new Option( ... ) - the new option
element is created in the window/frame in which the - Option -
constructor being used is located. Attempting to add that option to an
element of a form in another window/frame will not work.

Usually the simplest solution is to create a function in the
frame/window in which the form resides that will take (string and/or
number) arguments and locally create a new Option and insert it in the
form, calling that function from the separate frame/window.
//--------------------------------------------------
If you are going to post to Usenet you should use the specified standard
signature separator.
Kevin Auch
MVP .NET


MVP?

Richard.
Jul 23 '05 #2

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

Similar topics

8
by: Usman | last post by:
Huy everyone , Well I am not a big C++ programmer , I am just a little young kid on it tryint to learn . Actually I was given an assignment last week by my teacher which I solved ...
38
by: Martin Marcher | last post by:
Hi, I've read several questions and often the answer was 'C knows nothing about .' So if C knows that little as some people say, what are the benefits, I mean do other languages know more...
11
by: Steve | last post by:
Hi, i know this is an old question (sorry) but its a different problem, i need to write a binary file as follows 00000011 00000000 00000000 00000101 00000000 11111111
2
by: Mehta Shailendrakumar | last post by:
Hi, I am sending this question again as new question rather than reply to old question Please refer below: struct raw_data { unsigned char x; unsigned char y; }; union full_data
10
by: Tom Dacon | last post by:
I'm curious to see if anyone has an opinion on this little design question - I'm doing a computational astronomy library in C#, purely for my own use, and one of the things that happens regularly...
5
by: Amirallia | last post by:
I developped a WEB application for a customer. All is ok. Now I have made changes in the Global.asax.vb file My question is what files must I send to the customer for having this changes ?...
13
by: Kiuhnm | last post by:
How would you implement a static dictionary with macros? For example, the five lines PL_FIND(MYDICT, HOUSE) PL_FIND(MYDICT, AUTO) PL_FIND(MYDICT, THIS_IS_NOT_IN_THE_DICTIONARY)...
6
by: Javier | last post by:
Hello people, I'm recoding a library that made a few months ago, and now that I'm reading what I wrote I have some questions. My program reads black and white images from a bitmap (BMP 24bpp...
23
by: guthena | last post by:
Write a small C program to determine whether a machine's type is little-endian or big-endian.
4
by: Wouter84 | last post by:
I got little question. I want to generate auto customernumber, with Surname as startpoint. I take first two chars from surname and convert them to ascii. But my function returns the varchar as 147...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.