HI there, How do I add a javascript function that gets called when the page loads in one of my views? Thanks, steve -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, I might sound like a noobie but this is what I''ve used in one of the projects... <script> function post_form() { document.hidden_form.submit(); } </script> <center> <img src="/images/wait.gif?1200420741" onload="post_form()" border="0"> <br> Redirecting you to the payment gateway... </center> I hope it helps :) -- Maku On Thu, Mar 27, 2008 at 7:06 PM, Steve Glaz < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > HI there, > > How do I add a javascript function that gets called when the page loads > in one of my views? > > Thanks, > steve > -- > 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 -~----------~----~----~----~------~----~------~--~---
U can do like this either in the layout <body onunload="your_unload_function()" onload=your_load_function();> <SCRIPT language=JavaScript type=text/javascript> function your_unload_function() { //alert(' '); } function your_load_function() { //alert(' '); } On Thu, Mar 27, 2008 at 7:13 PM, मयंक जैन (makuchaku) <mayank.gnu@gmail.com> wrote:> Hi, > > I might sound like a noobie but this is what I've used in one of the > projects... > > <script> > function post_form() > { > document.hidden_form.submit(); > > } > > </script> > > > <center> > <img src="/images/wait.gif?1200420741" onload="post_form()" border="0"> <br> > > Redirecting you to the payment gateway... > </center> > > > I hope it helps :) > > -- > Maku > > > > > On Thu, Mar 27, 2008 at 7:06 PM, Steve Glaz < > rails-mailing-list@andreas-s.net> wrote: > > > > > HI there, > > > > How do I add a javascript function that gets called when the page loads > > in one of my views? > > > > Thanks, > > steve > > -- > > 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---