[Project_owners] changing the oncommand attr/prop of <command/>

eric.jung at yahoo.com eric.jung at yahoo.com
Fri Sep 14 13:35:11 PDT 2007


Actually, it turned out to be:

function fcn() { /* do something */ }
document.getElementById("aId").oncommand=fcn;

Thanks everyone,
Eric

----- Original Message ----
From: Andrew Razzano <srazzano at gmail.com>
To: Mozdev Project Owners List <project_owners at mozdev.org>
Sent: Tuesday, September 11, 2007 12:00:47 AM
Subject: Re: [Project_owners] changing the oncommand attr/prop of <command/>

On 9/10/07, Eric H. Jung <eric.jung at yahoo.com> wrote:
>
> Hi,
>
> I have:
>
> <command id="aId"
>   tooltip="&opts.102.tooltiptext;"
>   oncommand=""
>   observes="account-folder-selected"/>
>
> How can I programmatically change the function that gets called when the
> command fires? I've tried variations like:
>
> function fcn() { alert('hello wurld'); }
> document.getElementById("aId").setAttribute("oncommand",
> fcn);
> document.getElementById("aId").setAttribute("oncommand",
> "fcn");
> document.getElementById("aId").setAttribute("oncommand",
> fcn());
> document.getElementById("aId").setAttribute("oncommand",
> "fcn()");
> document.getElementById("aId").oncommand=fcn;
> document.getElementById("aId").oncommand="fcn";
> document.getElementById("aId").oncommand=fcn();
> document.getElementById("aId").oncommand="fcn()";
>
> Should I be using an event listener instead?
>
> Thanks,
> Eric
>
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>
document.getElementById("aId").setAttribute("oncommand", "fcn();");
_______________________________________________
Project_owners mailing list
Project_owners at mozdev.org
http://mozdev.org/mailman/listinfo/project_owners




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20070914/6b4a9660/attachment.html 


More information about the Project_owners mailing list