Hello, Here''s a small example of code to open a new window when a link is clicked. The below code works fine in FF, but IE 7 opens the URL in the same window. How come? $(''element-id'').observe(''click'', function(event) { window.open(event.element().getAttribute(''href''), ''window-id''); Event.stop(event); }); Regards, Rytis --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, Try the following code: document.observe(''dom:loaded'', function() { $(''element-id'').observe(''click'', function(event) { event.preventDefault(); window.open(event.element().getAttribute(''href''), ''myPopup'', ''width=640,height=480''); }); }); I''ve just tested it both in FF and IE. It works fine for me On Apr 8, 12:39 pm, Rytis Daugirdas <rytis.daugir...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > Here''s a small example of code to open a new window when a link is > clicked. The below code works fine in FF, but IE 7 opens the URL in > the same window. How come? > > $(''element-id'').observe(''click'', function(event) > { > > window.open(event.element().getAttribute(''href''), ''window-id''); > Event.stop(event); > }); > > Regards, > Rytis--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Actually, Event.stop() works fine. The problem was the ''-'' character in the window id (''window-id'' in the example above). On Apr 8, 9:12 pm, websash <webs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Try the following code: > > document.observe(''dom:loaded'', function() { > $(''element-id'').observe(''click'', function(event) { > event.preventDefault(); > window.open(event.element().getAttribute(''href''), ''myPopup'', > ''width=640,height=480''); > }); > > }); > > I''ve just tested it both in FF and IE. It works fine for me > > On Apr 8, 12:39 pm, Rytis Daugirdas <rytis.daugir...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, > > > Here''s a small example of code to open a new window when a link is > > clicked. The below code works fine in FF, but IE 7 opens the URL in > > the same window. How come? > > > $(''element-id'').observe(''click'', function(event) > > { > > > window.open(event.element().getAttribute(''href''), ''window-id''); > > Event.stop(event); > > }); > > > Regards, > > Rytis--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---