javascript - How to pass an argument in a function call?
Posted
by Fernando SBS
on Stack Overflow
See other posts from Stack Overflow
or by Fernando SBS
Published on 2010-05-10T18:03:34Z
Indexed on
2010/05/10
18:14 UTC
Read the original article
Hit count: 326
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?
© Stack Overflow or respective owner