1

此 javascript 代码在 IE8 中不起作用,但在 Firefox 和 Google Chrome 中有效:

<% content_for :head do %>
  <script type="text/javascript">
    document.observe("dom:loaded", function(){
      // Observe toggler
      $('toggle_all').observe('change', function(){
        var toggle = $('toggle_all').checked;
        $$('.check_boxes').each(function(check){
          check.checked = toggle;
        });
      })
    })
  </script>
<% end %>

<table>
<tr>
    ...
    <th><%= check_box_tag "toggle_all", 1, false %></th>
    ...
</tr>

<% reset_cycle %>
<% @estudantes.each do |estudante| %>
  <tr class="<%= cycle("even", "odd") -%>">
    ...
    <td><%= check_box_tag("candidato_ids[]", estudante.id, 
      (checked = true if @vaga.candidato_ids.include?(estudante.id)), :class => 'check_boxes' ) %></td>
    ...
  </tr>
<% end %>
</table>

<%= submit_tag t('others.call', :item => 'vaga') %>
</form>

谁能帮我?

4

1 回答 1

1

IE是一款优秀的浏览器。我们必须将焦点从代码工作的复选框上移开。跨浏览器代码对不上IE,呵呵

编辑:但将“更改”替换为“点击”也很有效。

于 2010-03-06T04:24:09.280 回答