I''m trying to use identify() to get the clicked element ID to pass to the toggle function.. it errors with ''does not support this property or method'' This isn''t final code, I''m just trying to get it to work. Thanks in advance for your time and help. - Brent N. ------------------------------------------------------------------------------ Browser: IE6 Prototype lib ver: 1.5.1.1 ------------------------------------------------------------------------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <script type="text/javascript" src="../scripts/prototype.js"></script> <script type="text/javascript" src="../scripts/scriptaculous.js"></ script> /* init section */ window.onload = function() { loadProjectControlMenu(); }; function loadProjectControlMenu() { Event.observe(''toggleStatus'',''click'', getThis, false); Event.observe(''toggleConstStatus'',''click'', getThis, false); } function getThis(evt){ // this works el = Event.element(evt); // this works and returns the HTML tag al = Object.inspect(el); // this does not work no matter how I structure it ax = Element.identify(al); alert(al); alert(ax); // the goal is to substitute in the clicked element ID where ''el'' is in the ''toggle'' below.. //Effect.toggle(el,''slide''); } </head> <body> <div id="controlStatus"> <p id="toggleStatus">Status -</p> <div id="interfaceStatus" style="display:none;"><div> stuff here </div></div> </div> <div id="controlConstStatus"> <p id="toggleConstStatus">Construction Status -</p> <div id="interfaceConstStatus" style="display:none;"><div> stuff here </div></div> </div> </body> </html> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> /* init section */ > window.onload = function() { > loadProjectControlMenu(); > > };This is actually redundant. You could assign handler to onload event directly: window.onload = loadProjectControlMenu;> > function loadProjectControlMenu() > { > Event.observe(''toggleStatus'',''click'', getThis, false); > Event.observe(''toggleConstStatus'',''click'', getThis, false); > > }"useCapture" in Event.observe (last argument) is "false" by default, so there''s no need to specify that either.> > function getThis(evt){ > // this works > el = Event.element(evt); > // this works and returns the HTML tag > al = Object.inspect(el); > // this does not work no matter how I structure it > ax = Element.identify(al); > alert(al); > alert(ax); > // the goal is to substitute in the clicked element ID where ''el'' is > in the ''toggle'' below.. > //Effect.toggle(el,''slide'');} >#identify was introduced in 1.6, so you would need to upgrade first. Also, it''s a good idea to define variables as local (by prefixing them with "var") - otherwise you might accidentally overwrite other global variables. Best, kangax --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
kangax, Thanks for the reply. I upgraded, changed the code a bit and got it all worked out. BN On Apr 10, 5:18 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > /* init section */ > > window.onload = function() { > > loadProjectControlMenu(); > > > }; > > This is actually redundant. You could assign handler to onload event > directly: > window.onload = loadProjectControlMenu; > > > > > function loadProjectControlMenu() > > { > > Event.observe(''toggleStatus'',''click'', getThis, false); > > Event.observe(''toggleConstStatus'',''click'', getThis, false); > > > } > > "useCapture" in Event.observe (last argument) is "false" by default, > so there''s no need to specify that either. > > > > > function getThis(evt){ > > // this works > > el = Event.element(evt); > > // this works and returns the HTML tag > > al = Object.inspect(el); > > // this does not work no matter how I structure it > > ax = Element.identify(al); > > alert(al); > > alert(ax); > > // the goal is to substitute in the clicked element ID where ''el'' is > > in the ''toggle'' below.. > > //Effect.toggle(el,''slide'');} > > #identify was introduced in 1.6, so you would need to upgrade first. > Also, it''s a good idea to define variables as local (by prefixing them > with "var") - otherwise you might accidentally overwrite other global > variables. > > Best, > kangax--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---