How do I call a function from Toolbar button?

I can’t seem to find anywhere in the docs how to actually make the toolbar buttons work, just bits and pieces of information here and there.

I have the following button:

I have the following attachEvent:

I want to use this function in the above event:

My question is: how do I target a specific button ID?

myToolbar.addButton("new", 0, "New", "new.gif", "new_dis.gif"); myToolbar.attachEvent("onClick", function(id) { if(id=="new"){ row_addtop(); } });