Create the menu first and then call 'appendItem' method to append menu item to your menu.
The easiest way to create menu is to add 'easyui-menu' class attribute to a <div/> markup, just like this:
<div id="div_menu" class="easyui-menu" style="width:100px;"></div>
Now you can call the 'appendItem' method:
var arrs = ["test1","test1","test1","test1"];
for (var i=0;i<arrs.length;i++) {
$("#div_menu").menu('appendItem', {
text:arrs[i],
onclick:'javascript:alert("ok")'
// or
// handler:function() {alert("ok")}
});
}