jquery - Javascript: how to call function through variable and pass parameters -
this question has reply here:
javascript - variable in function name, possible? 4 answersi want phone call function variable got success want phone call function , pass parameters,how it. please allow me know.
below have mention function working without parameter.
function myfunction(){ alert("hellow world"); } var aa= "myfunction"; window[aa](); // working
function myfunction(param){ alert(param); } // .....?
you can pass arguments function phone call window[aa]()
so:
function myfunction(text){ alert(text); } var aa= "myfunction"; window[aa]("hello again..."); // set arguments in parentheses.
javascript jquery
No comments:
Post a Comment