i''ve written script function ganesh.js inside "public/javascripts/" path.. ganesh.js.. function gan() { alert(''hai''); } ive called that function in show.rhtml file like <%= image_tag(''e.image'', {:id => e.id, :onload => gan()}) %> i cant able to call that function ...is there any other way to enable javascript function in ruby rails..pls help.. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
if i wrote script inside rhtml its working .... <%=link_to_function("add","gan()")%> <script type="text/javascript"> function gan() { alert(''hai''); } </script> how to enable javascript function from public/javascripts folder... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11 Jul 2008, at 09:45, Jai zenag wrote:> > i''ve written script function ganesh.js inside "public/javascripts/" > path.. > > ganesh.js.. > > function gan() > { > alert(''hai''); > } > ive called that function in show.rhtml file like > > <%= image_tag(''e.image'', {:id => e.id, :onload => gan()}) %> >that would need to be> <%= image_tag(''e.image'', {:id => e.id, :onload => "gan()"}) %>You would need to include the relevant javacript file using javascript_include_tag Fred> i cant able to call that function ...is there any other way to enable > javascript function in ruby rails..pls help.. > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It may be one of the following two reasons for getting the problem. 1. You have not included the relevant javascript in the rhtml file. The following statement should be there in the rhtml file. <%= javascript_include_tag ''ganesh.js'' %> 2. You have not called the javascript method inside quotes. Try with, <%= image_tag(''e.image'', {:id => e.id, :onload => "gan();"}) %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
THANK U VERY MUCH Karthi .....IT WORKS FINE... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---