我的/assets/javascripts/leads.js.coffee中有这个
jQuery ->
getRowColour = (status) ->
switch status
when "rejected" then return '#FFA500'
when "confirmed" then return '#C0C0C0'
when "didn't connect" then return '#90EE90'
else return '#FFFFFF'
这在我的/views/leads/index.html.erb
<%= f.select(:status, ["to call","didn't connect","confirmed","rejected"], {:selected => lead.status}, :onchange => "$('#lead_form_#{lead.id}').submit();document.getElementById('lead_row_#{lead.id}').style.backgroundColor=getRowColour(#{lead.status});") %>
<% end %>
可以看出我在 f.select 中的 onchange 函数有一个 javascript,它调用我的咖啡脚本文件中的函数。
请告诉我哪里出错了?