Heya, folks -
I'm trying to create a SELECT menu with option values that clear other
items when clicked on. (Essentially, these are categories and
subcategories.) This is the code I'm using:
var EventMenuMaster = Class.create();
EventMenuMaster.prototype = {
initialize: function() {
var check_items = this.check_items.bindAsEventListener(this);
var someNodeList =
$('game_types').getElementsByTagName('option');
var nodes = $A(someNodeList);
nodes.each(
function(node){
node.onclick = check_items;
alert(node.value);
}
);
},
check_items: function(e) {
alert('Item is checked!');
}
}
var EventMenuMaster;
window.onload = function() {
EventMenuMaster = new EventMenuMaster();
alert('Set trigger?');
}
Unfortunately, this triggers events in Firefox and Opera, but fails in
Internet Explorer, Chrome, and Safari (though it does loop through the
menu and alerts with each value).
I thought it might be that I needed to use the onfocus method, but
that fails as well. And I use a more-or-less identical code snippet
to assign onclick events to checkboxes, and that works fine, so my
current theory is that it's something in the way IE and Opera handle
option models.
In any event, I can't seem to get the check_items function to trigger
- any ideas why?
(The HTML is valid as far as I can tell. I can provide samples if
need be, but I didn't want to give an absurdly long post.)
Thanks,
T.F.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---