Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14103

Re: Accessing a <select> <option> ?

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "Mel Smith" <med_cutout_syntel@aol.com>
Newsgroups comp.lang.javascript
Subject Re: Accessing a <select> <option> ?
Date Tue, 22 May 2012 15:09:24 -0600
Lines 44
Message-ID <a22dkbF24fU1@mid.individual.net> (permalink)
References <a2273uFft7U1@mid.individual.net> <jpgtps$v0t$1@dont-email.me>
X-Trace individual.net sZ7A48sf/LJMbsmYNFYtOAv61Rae0WokTWvbU9r7ymV+a35M8TDg8tjZDrL80ESHUM
Cancel-Lock sha1:SwE9rL2LJvRJBXrzn5Tqexf5YpI=
X-Priority 3
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.6157
X-RFC2646 Format=Flowed; Response
Xref csiph.com comp.lang.javascript:14103

Show key headers only | View raw


Matt said:
[snip]

> Yes; you are correct in noting that the `click` event does
> not work well with option elements. Perhaps, as has been
> suggested in various threads before, you could add a `blur`
> and/or `focus` event handler to the select element and track
> "changes" that way. The first selected option (presence of
> the `multiple` boolean attribute was not specified) can be
> retrieved via the `selectedIndex`[1] property of the
> `HTMLSelectElement`interface.
>

Hi Matt:
    Yes, I use -- and have used many times the '<body 
onload="somefunction();" >' -- and it always seemed to work on *other* 
elements (e.g., <input>, etc).

    In IE 7, in my sequence of commands, where I assign a unique  ID to each 
of my options, and then 'look' at these options thru Alerts, they IDs *do* 
exist.

    In current versions of  FF and Chrome, the 'optel.onclick=myFunc'  works 
perfectly !!!,   but in IE7 it is ignored (that is, myFunc is not executed??

(btw, Matt I live/work in St. Alberta, AB just a couple of miles from you 
:))  Also, one of  my sons is a business manager with a computer systems 
development firm in Edmonton. Let me know if you'd like to touch bases with 
him.  )

> (e.g. `var curOption = sel.options[sel.selectedIndex];`)

    I'll give that a try --- but I'm disappointed that IE7 can't work like 
FF & Chrome (and I do all my developing in IE7, and check my work on the 
other browsers frequently.
>
> [0]: http://www.whatwg.org/specs/web-apps/current-work/multipage
> /sections.html#the-body-element
> [1]: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-85676760
>
> -- 
> Matt McDonald: Web/Flash Developer; Edmonton, Alberta, Canada 

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Accessing a <select> <option> ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-05-22 13:18 -0600
  Re: Accessing a <select> <option> ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-05-22 13:43 -0600
  Re: Accessing a <select> <option> ? Matt McDonald <matt@fortybelow.ca> - 2012-05-22 14:43 -0600
    Re: Accessing a <select> <option> ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-05-22 15:09 -0600
      Re: Accessing a <select> <option> ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-05-22 20:26 -0600
  Re: Accessing a <select> <option> ? SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-05-23 21:17 +0200
    Re: Accessing a <select> <option> ? "Mel Smith" <med_cutout_syntel@aol.com> - 2012-05-23 13:42 -0600
    Re: Accessing a <select> <option> ? "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-05-23 21:17 +0000

csiph-web