Make a new Option object, from a different opened window

  • Thread starter Superfox il Volpone
  • Start date
S

Superfox il Volpone

Hi guys,
I'm trying to insert a new <option> in a select, but from a new opened
window. The code I've written is :
function chiudi(ref_id, opt_id, opt_name){
select = window.opener.document.getElementById('lnk_categ_' +
ref_id);
select.options[select.length] = new Option(opt_id, opt_name, true);
//self.close();
}
the args opt_id and opt_name are the value and the name of the option,
ref_id is a string to retrieve the <SELECT> object from the opener
document.
I'm sure that the <SELECT> object is retrieved (I've printed on screen
some its property).
So what's the error ? The IE Debugger give me an "Unknown error" on
the row select.options....

Bye
- Dean
 
G

getsanjay.sharma

Hi guys,
I'm trying to insert a new <option> in a select, but from a new opened
window. The code I've written is :
function chiudi(ref_id, opt_id, opt_name){
select = window.opener.document.getElementById('lnk_categ_' +
ref_id);
select.options[select.length] = new Option(opt_id, opt_name, true);
//self.close();}

the args opt_id and opt_name are the value and the name of the option,
ref_id is a string to retrieve the <SELECT> object from the opener
document.
I'm sure that the <SELECT> object is retrieved (I've printed on screen
some its property).
So what's the error ? The IE Debugger give me an "Unknown error" on
the row select.options....

Bye
- Dean

There is an add() method for 'select' element adds a new option
element to the select box.

See this: http://www.w3schools.com/htmldom/met_select_add.asp

/^STS$/
 
T

Thomas 'PointedEars' Lahn

There is an add() method for 'select' element adds a new option
element to the select box.

See this: http://www.w3schools.com/htmldom/met_select_add.asp

This will fail in the MSHTML DOM (and so in the OP's IE) where add() is
implemented differently.

Maybe apart from browser usage figures, the Web site above should not be
considered reference material at all.

That can be found here instead:

http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-14493106
http://msdn2.microsoft.com/en-us/library/ms535921.aspx

Please trim your quotes as explained and recommended in the FAQ:

http://jibbering.com/faq/


PointedEars
 
S

Superfox il Volpone

This will fail in the MSHTML DOM (and so in the OP's IE) where add() is
implemented differently.

Maybe apart from browser usage figures, the Web site above should not be
considered reference material at all.

That can be found here instead:

http://www.w3.org/TR/DOM-Level-2-HT...dn2.microsoft.com/en-us/library/ms535921.aspx

Please trim your quotes as explained and recommended in the FAQ:

http://jibbering.com/faq/

PointedEars

Hi,
it works :)

Thank you both!

About the W3C reference, the problem is the index and the position of
the contents, it could require some time to find what you are looking
for.

Bye
- Dean
 
T

Thomas 'PointedEars' Lahn

Superfox said:
[Full quote]

Hi,
it works :)

Thank you both!

Thank you in advance for taking heed of the *already given* recommendations
regarding accepted posting style in Usenet and for not further using Google
Groups' faulty Web interface for posting to Usenet in the future.
About the W3C reference, the problem is the index and the position of
the contents,
Pardon?

it could require some time to find what you are looking for.

Maybe if you are still on a V.24 analogue telephone line which I seriously
doubt The Robert Gordon University of Aberdeen provides anymore.

There is a link for `add' in the index of the DOM Level 2 HTML Specification
(that has exactly the same URL that I posted before) which is not hard to find:

http://www.w3.org/TR/DOM-Level-2-HTML/def-index.html

Of course, if you don't know what the (W3C) DOM is, you don't know where to
look for. But then you should not be writing client-side scripts anyway.


PointedEars
 
S

Superfox il Volpone

Thomas 'PointedEars' Lahn said the following on 10/14/2007 7:04 PM:
[Full quote]
Thank you in advance for taking heed of the *already given* recommendations
regarding accepted posting style in Usenet and for not further using Google
Groups' faulty Web interface for posting to Usenet in the future.

There is nothing wrong with posting from Google Groups as long as you
understand the problems with it and work accordingly.

Sorry about, I'm not able to access without Google Groups and I don't
understand where is the problem posting with it :(

I know what is the W3C, the problem with that reference are two :
1) it's uncomfortable ;( I'm accustomed to work with many pages, in
W3C reference does not exist an index of the properties or of the
methods of a particular object/node/how you call it :), so it could be
boring and slow to find what you are looking for scrolling the same
page :/
2) the second problem, browsers, several times, do not respect the
"W3C standard", so it could usefull to check a global overview to know
what one could really use or not... but this is just my humble
opinion...

Sorry again, Thomas, I know that you will get more angry with this
post, but as I said, I don't understand where is the problem :(

Bye
- Dean
 
T

Thomas 'PointedEars' Lahn

Superfox said:
Thomas 'PointedEars' Lahn said the following on 10/14/2007 7:04 PM:
[Full quote]
Thank you in advance for taking heed of the *already given* recommendations
regarding accepted posting style in Usenet and for not further using Google
Groups' faulty Web interface for posting to Usenet in the future.
There is nothing wrong with posting from Google Groups as long as you
understand the problems with it and work accordingly.

Sorry about, I'm not able to access without Google Groups and I don't
understand where is the problem posting with it :(

Try news.newusers.questions.
I know what is the W3C, the problem with that reference are two :
1) it's uncomfortable ;( I'm accustomed to work with many pages, in
W3C reference does not exist an index of the properties or of the
methods of a particular object/node/how you call it :),

But it does, you just have not noticed it yet (despite several pointers).

What you have to get accustomed to is that teh W3C DOM Specifications are
specifications of interfaces to be implemented, not exactly of objects.
So instead of `select object' you look for the specification of the
`HTMLSelectElement interface'.

And, again, there *is* one link to the "add" method in the "index" of the
Specification (and the link to that can be found on top of the "contents").
2) the second problem, browsers, several times, do not respect the
"W3C standard", so it could usefull to check a global overview to know
what one could really use or not... but this is just my humble
opinion...

JFTR: It is for the most part Microsoft Internet Explorer/MSHTML that does
not respect the Web standards.

However, because that is so, most vendors have reference material on their
Web sites. I also pointed to you one of them (MSDN Library) already.
Sorry again, Thomas, I know that you will get more angry with this post,

You have yet to observe me being angry :) I just wonder how you can be
unable to follow the many pointers you have been given.
but as I said, I don't understand where is the problem :(

The problem is that you are not really asking about what you don't
understand (here, or via private e-mail). So it is difficult to provide a
helpful answer.

<hint-hint-hint>

I have pointed you to the FAQ http://jibbering.com/faq/ already. There is a
section "2.3 What do I have to do before posting to clj?" which contains a
link to

http://www.jibbering.com/faq/faq_notes/clj_posts.html

This should contain everything you need to know regarding proper posting on
Usenet. Please also consider

<FAQENTRY>

How do I quote correctly in Usenet?
http://netmeister.org/news/learn2quote.html

</FAQENTRY>

</hint-hint-hint>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top