I'm still quite new to Prototype, but I think you're missing some quotes in your code below. What you have now is
var para = new Element('p', {'class':'button',onclick:'alert("hello");'}).update("Alert You?"); Shouldn't it be var para = new Element('p', {'class':'button',onclick:'\'alert("hello");\''}).update("Alert You?"); -- Jonathan Rosenberg Founder & Executive Director Tabby's Place http://www.tabbysplace.org -----Original Message----- From: prototype-scriptaculous@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of johnrails Sent: Tuesday, October 28, 2008 7:53 PM To: Prototype & script.aculo.us Subject: [Proto-Scripty] obtrusive even handlers not working in generated content Hi all, I'm having a small issue with generated content using prototype's Element object. Here's the gist of what i'm doing var para = new Element('p', {'class':'button',onclick:'alert("hello");'}).update("Alert You?"); after i just insert this into a div on my page. When i go to the page i do get the text "Alert You?" but the onclick only works in firefox. I get nothing out of IE not even an error. It seems to work if i do this: var para = '<p class="button" onclick="alert(\'Alert You?\');">Alert You?</p>'; then i insert the p into my container div. I know doing event handlers like this is bad, bad, and frowned upon, but even if i do it unobtrusively it still doesn't work in IE6 or 7. Any help would be much appreciated. John --~--~---------~--~----~------------~-------~--~----~ 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 prototype-scriptaculous@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---