Ruby on rails 3.2 Rails:在Rails中编写onclick代码

Ruby on rails 3.2 Rails:在Rails中编写onclick代码,ruby-on-rails-3.2,Ruby On Rails 3.2,您可能会发现这个非常基本的问题,但我不知道如何在rails中编写此代码: <input type='image' src='http://images.aviary.com/images/edit-photo.png' value='Edit photo' onclick="return launchEditor('image1', 'http://images.aviary.com/imagesv5/feather_default.jpg');" /> 我上传照片,需要使用上

您可能会发现这个非常基本的问题,但我不知道如何在rails中编写此代码:

  <input type='image' src='http://images.aviary.com/images/edit-photo.png' value='Edit photo' onclick="return launchEditor('image1', 'http://images.aviary.com/imagesv5/feather_default.jpg');" />
我上传照片,需要使用上述代码编辑照片

在这里,我想使用以下代码:

<%= image_tag photo.object.avatar.url(:thumb), :class => "foodio_photo" unless f.object.new_record? or photo.object.new_record? %>

请帮忙!我是新手。

首先,在javascript文件中放置onclick。也就是说,这应该是可行的:


foodio_photo,:onclick=>dosomethingWithis,除非f.object.new_记录?或photo.object.new_记录?%%>我相信你的问题可以在这里解决:如果你还没有解决,请在你想做的地方提供erb代码。嘿@wintermeyer,在我想写html js代码的地方添加了代码