Hello, rubiers. now, I wanna call some functions in A site that was already implemented by another company. ( I don''t know internal... just nothing..) anyway, there are several javascript functions in there what I want call frequently in my ruby scripts. HOW DO I connect it and call it? Could you give me some examples? for example) <head> hello, this is template!! </head> <body> <a href=''javascript:func_a(arg1, arg2, arg3)''>click</a> </body> func_a().... that is my goal to call in my scripts. thanks you. </body> -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jun Young wrote:> <head> > hello, this is template!! > </head> > <body> > <a href=''javascript:func_a(arg1, arg2, arg3)''>click</a>This is a very old technique and I would not recommend using this style to call JavaScript functions. Here is a more modern syntax: <a href="#" onclick="func_a(arg1, arg2, arg3); return false;">click</a> The most recent trend that is emerging is called "Unobtrusive JavaScript." This new technique separates page behavior from page structure and presentation. Notice the "return false;" at the end of the onclick attribute. http://en.wikipedia.org/wiki/Unobtrusive_JavaScript> </body> > func_a().... that is my goal to call in my scripts. > thanks you. > </body>I would recommend putting your JavaScript functions in an external file inside "public/javascripts" and include them from inside <head>: <head> <%= javascript_include_tag ''application'' %> </head> Or, if you want to also include the Prototype JavaScript libraries: <head> <%= javascript_include_tag :defaults %> </head> Doing this will also include public/application.js along with the Prototype library. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
actually, this is not what i want to do ;) sorry my poor english sentences made you misunderstand it. okay. if there is a general website like amazon, the site has plenty of javascript function. the one of them is func_a() function what I want to call it. in my local, there is a ruby script to check some situation that does satisfy any conditions. by using this ruby script, I want to call func_a() in a server-side. is this possible? I think this is really easy functionality. but I could not find any solutions for me. thanks for your concerns. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Narendra sisodiya
2010-Feb-09 12:12 UTC
Re: Re: How to call javascript function in A site?
following code might help you <% if rails_condition%> <script> func_a(arg1,arg2,arg3); </script> <%end%> Regards, Naren On Tue, Feb 9, 2010 at 5:21 PM, junyoung kim <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> actually, this is not what i want to do ;) > sorry my poor english sentences made you misunderstand it. > > okay. > > if there is a general website like amazon, the site has plenty of > javascript function. > > the one of them is func_a() function what I want to call it. > > in my local, > there is a ruby script to check some situation that does satisfy any > conditions. > by using this ruby script, I want to call func_a() in a server-side. > > is this possible? > I think this is really easy functionality. but I could not find any > solutions for me. > > thanks for your concerns. > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.