[Project_owners] changing the oncommand attr/prop of <command/>
Andrew Razzano
srazzano at gmail.com
Mon Sep 10 21:00:47 PDT 2007
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();");
More information about the Project_owners
mailing list