Try

        $('btn1').writeAttribute('onclick', "function () { alert(123); }");

And you can still do what you want with observe, BTW.

--
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 Cliff
Sent: Sunday, October 26, 2008 2:42 PM
To: Prototype & script.aculo.us
Subject: [Proto-Scripty] writeAttribute and onclick fails in IE6



Hi all,

I have a button like this: <a id="btn1">some button</a>
This code works in safari and firefox, but fails in IE6: $
('btn1').writeAttribute('onclick', "alert(123)");
The onclick event does not fire in IE6.

What should I do?
I know Event.observe is better, but I want to use variables to pass a
function, e.g.
  var functionslist = "alert(123); alert(321)";
  $('btn1').writeAttribute('onclick', functionslist);

Thanks!




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to