Hi guys

I am having slight issue with IE6 and Prototype. I have a function
which should return the clicked value of a form element but is
returning null. The form element is as follows:

<select size="5" id="vehicles-multi-select" name="vehicles"
  <option id="vehicles-select-all">All vehicles</option>
  <option class="vehicles-options" id="vehicle-1" value="1"'>1</
  <option class="vehicles-options" id="vehicle-2" value="2"'>2</
  <option class="vehicles-options" id="vehicle-3" value="3"'>3</
  <option class="vehicles-options" id="vehicle-4" value="4"'>4</

The function is as follows:

handleVehiclesClick: function(e){
  var val = '';
  if (Prototype.Browser.IE) {
    val = Event.element(e).getValue();
  } else {
    val = Event.element(e).innerHTML;
  if (val != 'All vehicles') {
    $('vehicles-select-all').selected = false;
  } else if(val != '') {
      e.selected = true;

Variable e is an object relating to the element in the DOM that was
clicked. In this case, it will be one of the option elements.

What should happen is if you click All Vehicles, all of the option
with class vehicle-options should get selected and if a single option
of class vehicle-options is clicked, that one should be selected and
no others.

When I use Firefox, Chrome, Safari, Opera, IE7 and IE8 this works as
normal. However this fails to work in IE6 and I am struggling to work
out why. However (and this is the good part), if I put an alert just
after the val variable is declared (no specific alert, ANYTHING will
do) the script works for IE6. This makes debugging difficult as I
can't alert different elements and values to see if they are as
expected without "fixing" the code.

Any help will be much appreciated.

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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to