I switched to using Element.observe() and it started working in IE6 & 7. I guess I don't need a solution to setting onclick directly, but if anyone has any insight, please share.
Thanks. On Dec 1, 1:39 pm, JoJo <[email protected]> wrote: > If I dynamically create an achor in IE6 and IE7, it's onclick event > won't fire when clicked on. Below is an example of a static anchor > and dynamic anchor - both are supposed to pop up an alert. Why does > only the static anchor work? > > ++++++++++++++++++++++++++++ > JS JS JS JS JS JS JS JS JS JS JS JS > ++++++++++++++++++++++++++++ > > $('dynamicLink').appendChild( > new Element( > 'a', { > href: '#', > onclick: "alert('this link works')" > } > ).update('dynamic power button') > ); > > ++++++++++++++++++++++++++++ > HTML HTML HTML HTML HTML HTML > ++++++++++++++++++++++++++++ > > <a > href="#" > onclick="alert('this link works')"> > static power link > </a> > > <div id="dynamicLink"></div> -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
