The following code is working in Firefox, but not IE7. The problem
stems from trying to determine the index of an <option> element of a
<select> list.
// where e is an event triggered by clicking on the <option>
function toggleOption(e){
var opt = Event.element(e);
var i = opt.index;
alert(i + " " + opt.value); // debug
statusOptions[i] = !statusOptions[i];
replaceOptions();
}
in IE7, my variable ''i'' is undefined. is there a better way
to obtain
this value in IE7?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2008-Mar-12 21:18 UTC
Re: Frustration with IE7 and the <option> index property
Isn''t that supposed to be opt.selectedIndex? Walter On Mar 12, 2008, at 5:04 PM, James wrote:> var opt = Event.element(e); > var i = opt.index; >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I believe that is a property of the parent <select> element, but one
that I can certainly use for my purposes. Changing the code to...
function toggleOption(){
var i = $(''statusList'').selectedIndex;
statusOptions[i] = !statusOptions[i];
replaceOptions();
}
...solves my problem.
Thanks!
On Mar 12, 3:18 pm, Walter Lee Davis
<wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>
wrote:> Isn''t that supposed to be opt.selectedIndex?
>
> Walter
>
> On Mar 12, 2008, at 5:04 PM, James wrote:
>
> > var opt = Event.element(e);
> > var i = opt.index;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---