f.elements[i].setAttribute("onClick") = "alert('ss');";改为 f.elements[i].setAttribute("onclick") = "alert('ss');";

解决方案 »

  1.   

    f.elements[i].setAttribute("onclick","alert('ss');)";
      

  2.   

    f.elements[i].onclick = function(e){ alert('ss'); };这个好像可以
      

  3.   

    用这个试:f.elements[i].OnClick = func;按楼主的代码,只有最后一个控件是有效的,而其他的控件事件都无效!(为什么?我也不清楚)我以前也遇到过同样的问题,我的解决方法:在每个控件中添加一个属性(如:tooltip),将要传送的参数保存在这个属性里,然后,在每个控件中添加事件:f.elements[i].onClick="func(this)";
    添加处理函数:
    function func(o)
    {
        alert(o.tooltip);
    }
      

  4.   

    f.elements[i].setAttribute("value") = "123";这样设置属性就可以!
    ===========
    1。
    这样可以迈??????2。
    setAttribute 方法原型:Syntaxobject.setAttribute(sName, vValue [, iFlags])
    ParameterssName Required. String that specifies the name of the attribute. 
    vValue Required. Variant that specifies the string, number, or Boolean to assign to the attribute.  
    iFlags Optional. Integer that specifies one the following flags: 0 When the attribute is set, it overwrites any attributes with the same name, regardless of their case. 
    1 Default. The case of the attribute that you set is respected when it is set on the object. 
     Return ValueNo return value.3。f.elements[i].setAttribute("onClick") = "alert('ss');";》》》// IE
    f.elements[i].setAttribute("onclick", function() { "alert('ss');" } );// IE FF Opera
    f.elements[i].onclick = function() { "alert('ss');" };