struts1.2中function change(id){
    
    document.forms[0].parentId.value=xxx;
    //我想在这里改变document.forms[0].parentId的值,怎么改不了,调这段代码前下面的form已经提交了吗?
    
    document.forms[0].submit();
}<html:form action="catalog">
    <html:select property="parentId" onchange="change()">
     ....
    </html:select>
</html:form>

解决方案 »

  1.   

    你这样写吧:
    function change(){
        var t= document.getElementById('parentId').value;
       alert(t)
    t="xxx"
    alert(t)
    }
    <html:form action="catalog">
        <html:select property="parentId" onchange="change()">
         ....
        </html:select>
    </html:form>这样就能改变了!
    不会了再问!
      

  2.   

    你这样写吧: 
    function   change(obj){ 
            obj.value="";

    <html:form   action="catalog"> 
            <html:select   property="parentId"   onchange="change(this)"> 
              .... 
            </html:select> 
    </html:form>