这里的btncall只是一个普通的参数名,setBtnEvent并不会把它当成函数

解决方案 »

  1.   

    LZ 你在哪调用了setBtnEvent?just give you a simple examplefunction FunArg(fun,args){
    fun(args);
    }function testfun(arg){
    alert(arg);
    }FunArg(testfun,"This is the test");
      

  2.   

    哦 , 是在页面的初始化过程中.我要给一个table中的所有按钮更新,删除赋值,这个是通用函数.
      

  3.   


    function FunArg(args,fun){
        fun(args);    
    }function testfun(arg){
        alert(arg);    
    }FunArg(testfun,"This is the test");===========
    四楼的兄弟可以告诉我一下,为什么函数参数放第二个就报错呢?
    (fun,args) (args,fun)
      

  4.   

    我代码里的传参是:
    btncall传进去,
    然后再在里面btn数组的onclick事件赋值 btncall传参的时候 btn对象老是传不进去 郁闷.
      

  5.   

    参数位置是由你的FunArg定义是决定的LZ应该这样调用 FunArg("This is the test",testfun);
      

  6.   

    下面这句
    btns[i].onclick=btncall(btn[i]);
    似乎应该修改为,如果你的btn是全局变量的话
    btns[i].onclick="btncall(btn["+i+"])";