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

Eric H. Jung eric.jung at yahoo.com
Mon Sep 10 19:37:38 PDT 2007


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20070910/47e2e6a8/attachment.html 


More information about the Project_owners mailing list