You might have to cheat a little, but this will do the trick:
CmdUtils.CreateCommand({
name: "js",
description: "example of js in preview",
preview: function(pblock) {
var html = pblock.parentNode;
html.test = {Test: CmdUtils.log("hmm...")};
pblock.innerHTML = "<a href='#' onclick='test.Test();'>test</a>";
}
});
-- cers / Christian Sonne
On Sat, May 2, 2009 at 3:24 PM, Alphawolf <[email protected]> wrote:
>
> Hey there,
>
> I'm desperately trying to define a function to be used onclick inside
> the preview block of Ubiquity. So, the following (shortened) code for
> preview:
>
> preview: function(pblock, term) {
> [...]
> pblock.innerHTML = '<a href="#" onclick="test.Test();">Link</a>';
> [...]
> }
>
> And I'm trying to declare my own function:
>
> var test = {
> Test: function() {
> CmdUtils.log( 'Erm...' );
> }
> }
>
> But it doesn't work. So, how can I run my own functions from the
> preview block?
>
> Thanks, Oliver
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" 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/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---