使用
obj.onclick = "doSomeThing(document.getElementById('a'),document.getElementById('b'))";
修改了页面中如下内容
<IMG title="" style="CURSOR: hand" onclick="doNoThing(document.getElementById('a'),document.getElementById('b'))" src="xxx.gif" type="button">
后,点击该图片无反应,无报错,查看源码onclick内容也已经修改,另存为html也可以顺利的 doSomeThing 。默默无语两眼泪……

解决方案 »

  1.   


    obj.onclick = function(){
        doSomeThing(document.getElementById('a'),document.getElementById('b'));
    };
      

  2.   

    不太明白。
    obj是哪个对象。
    上面是doSomenThing
    下面是doNoThing
      

  3.   

    obj.onclick = "doSomeThing(document.getElementById('a'),document.getElementById('b'))";
    onclick 后面是要接function的
      

  4.   

    补充一下,doSomeThing这个方法是拼的,"doSomeThing(document.getElementById('"+a+"'),document.getElementById('"+b+"'))",这个...
      

  5.   


    obj.onclick = function(){
        s = "doSomeThing(document.getElementById('" + a + "'),document.getElementById('" + b + "'));";
        eval(s);
    };
      

  6.   

    hookee 灰常感谢~
    谢谢大家帮忙~