The DOM API is different from plain HTML. You don't assign strings to
the onclick attributes, but real JavaScript functions. Like:
a.onclick = function() { alert("hello"); }
or
a.onclick = new Function("alert('hello');");
Cheers,
/Per
On Wed, May 14, 2008 at 2:25 PM, aditi <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I have a problem of passing the objects to the onclick method.
> Here is what I am doing,
> in the kid page:
> <a class="actionbuttons" href="#" title="Edit this user"
> onclick="edit_user(${tg.encode(user)},${tg.encode(email_list)}, $
> {user.id})">Edit</a>
>
> where user is a database object. And email_list is a string containing
> emails.
>
> Now,
> when I recreate this anchor using swapDOM:
> A({'class':'actionbuttons', 'href':'#', 'title':'Edit this user',
> 'onclick':edit_user(user, email_list, user.id)'}, 'Edit')
>
> The problem is that it does not get the values to edit_user.
> So I even tried with creating a string variable like this:
> edit_onclick = "edit_user('"+user+"', '"+email_list+"', '"+user.id
> +"')";
> A({'class':'actionbuttons', 'href':'#', 'title':'Edit this user',
> 'onclick':edit_onclick}, 'Edit')
>
> So, can anyone please help me in this.
>
> Thanks,
> Aditi
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---