document.forms[0].all[i]返回的就是元素对象了

解决方案 »

  1.   

    document.forms[0].all[i].name.value="00";
    IE说"document.forms[0].all[i].name"不是对象。
    --------------------------------------------
    document.forms[0].all[i].value="00";
      

  2.   


    document.forms[0].all[i].value="00";
    ========================================
    各位大吓,上面这个方法你们可以写进去吗?
    可是为什么我的写不进去???
    我alert(document.forms[0].all[i])出来
    得到一个OBJECT,但是我运行后确写不进去!
      

  3.   

    <form>
    <input type="text">   
    <input type=button onclick='document.forms[0].all[0].value="12"'>
    </form>你看看这个是否可以写进去
    -------------------
    document.forms[0].all[i]以为它是个对象
    所以得到一个OBJECT
      

  4.   

    to: woyingjie(woyingjie) 
    这个方法可能不行,因为表单不是我定义的,所以我想要的是,只得到输入框后,把相应的值写进去,所以只能考虑=的方法了
      

  5.   

    <form>
    <input type="text">   
    <input type=button onclick='document.forms[0].all[0].value="12"'>
    </form>难道我写的这个不是吗?
    我没有给这个表单定义名字
    也没给那个文本框定义name 赋值用的也是这个
    document.forms[0].all[0].value="12"
    难道跟你说的有什么不一样吗?
      

  6.   

    我的表单如下:
    <form name="haha" method="post" action="test_1.asp">
      所属地区:<select name="mytest"><option value="" selected></option><option value='0.001' selected>总公司</option><option value='0.001.001'>上海</option>
      </select>
      姓名:<input type="text" name="address">    
      <p>
        表白:<textarea name="approach"></textarea>
      </p>
     <input type="submit" name="Submit" value="提交">
    </form>JavaScript如下:
    <Script Language ="JavaScript">
    <!--
      var s = '@@mytest=0.001@@approach=我一个人住@@address=爱我就来@@';
       var all=document.forms[0].elements;;
        for(var i=0;i<all.length;i++){
    if (all[i].type!="submit"){
            str1= s.substring(s.indexOf(all[i].name)) ;
     ss = str1.substring(str1.indexOf("=")+1,str1.indexOf("@@")) ;
     document.forms[0].all[i].value = ss ;//这里确没有写进去,一个也没有
            // 难道是我的IE的问题吗?  
     }
     else
     alert("ok");
      }
    </Script> 
      

  7.   

    to: woyingjie(woyingjie) 
    在吗?
      

  8.   

    <script>
    function b(){
    s = '@@address=中国人@@approach=我一个人住@@mytest=0.001@@'
    a=s.split("@@")
    for(i=1;i<a.length-1;i++){
    a[i] =  a[i].substring( a[i].indexOf("=")+1)
    }
    var all=document.forms[0].elements;
    var j=1
    for(var i=0;i<all.length;i++){
    if(all[i].type!="submit")
    alert(a[j])
    document.forms[0].all[i].value=a[j]
    j++
    }
    }
    </script>
    <body><form name="haha" method="post" action="test_1.asp"> 
      姓名:<input type="text" name="address"> 
      爱的表白:<input type=text name="approach">
      所属地区:
    <select name="mytest">
    <option value='0.001'>总公司
    <option value='0.001.001' selected>上海</option>
      </select>
     <input type=button onclick=b()>
    </form>-------------------------------
    你看看这个行吗?