javascript - How to pass an argument in a function call?
- by Fernando SBS
function rp_marcadesmarcaFarm(valor) {
FM_log(3, "marcadesmarcaFarm called = "+valor);
for (i = 0; i < farmList.length; i++) {
var arr = farmList[i].split("|");
var xy = arr[0].split(",");
var fvillageId = xy2id(parseInt(xy[0]), parseInt(xy[1]));
GM_setValue("farmAtivada_"+suffixLocal+fvillageId, valor);
GM_setValue("farmAtivada_"+suffixLocal+i, valor);
};
reloadFarmTable();
};
function createLinkButton(text, title, jsFunction, value) {
var button = dom.cn("a");
button.href = "javascript:void(0)";
button.innerHTML = text;
button.title = title;
if (jsFunction != null) {
button.addEventListener('click', jsFunction, false);
}
return button;
}
createLinkButton("X", T('CHECKFARM_M'), rp_marcadesmarcaFarm(true));
apparently the last argument (rp_marcadesmarcaFarm(true)) when invoking the createLinkButton is not working. If I change to:
createLinkButton("X", T('CHECKFARM_M'), rp_marcadesmarcaFarm);
it works. So how can I pass the (true) variable to the third argument of createLinkButton?