这个问题最好到Web板块的js论坛去问

解决方案 »

  1.   


    document.getElementByID("idName").innerHTML="<input type="text" name="txt" />";
      

  2.   

    hdown(一片天空) ( ) 信誉:100  2006-04-10 23:43:00  得分: 0  
     
     
       
    document.getElementByID("idName").innerHTML="<input type="text" name="txt" />";  
     
    ---------------------------------------
    就是这个思想,还有其他的方法,也可以达到这个效果,不过,思想是一样的。具体方法:参照 DOM 的操作。
      

  3.   

    生成文本框是用js写,但最主要的是formbean取值的问题。
    1.先做一个数据对象来取循环生成文本框的值:GetLoopTextValue,写个数组来取,具体的就不用写出来了吧
    2.在循环生成文本框时候,<html:text property="GetLoopTextValue.getText[1]">  生成时候注意getText[i]中的i变量就行了
    3.然后在formbean中直接取
     private GetLoopTextValue value = new GetLoopTextValue();    public CityStateZip getCityStateZip() {
           return value ;
        }
        
        public void setCityStateZip(CityStateZip value ) {
            this.value = value ;
        }
      

  4.   

    最近做的毕业设计也有这个技术 function AddRow(TableID)//在表的末尾添加一行
                {
                    var row =TableID.insertRow(TableID.rows.length);
                    var col = row.insertCell(0);
                    col.innerHTML = "<input type='checkbox'id='chk' name='chk' width='100%'>";
                
                    for(var i=1;i<=2;i++)
                    {
                       col = row.insertCell(i);
                       col.innerText="";
                    }
                       col = row.insertCell(3);
                       col.innerText="1";
                    col = row.insertCell(4);//检测部门
                    col.innerHTML=show_deptlist.innerHTML;//把一个层加进来
                    col = row.insertCell(5);//强检
                    col.innerHTML="<INPUT type='checkbox' name='ChkQJ'>";
                    col = row.insertCell(6);
                    col.innerText="";                  
                }<TABLE id="RecordTable" style="BORDER-COLLAPSE: collapse" onclick="EditRow(RecordTable)" borderColor="#c0c0c0" height="22" cellSpacing="1" cellPadding="2" width="794" border="1">
    <TR>
    <TD vAlign="middle" align="center" width="69" bgColor="#e1e1e1" height="10">
    选择
    </TD>
    <TD vAlign="middle" align="center" width="150" bgColor="#e1e1e1" height="10">
    器具ID
    </TD>
    <TD vAlign="middle" align="center" width="400" bgColor="#e1e1e1" height="10">
    器具名称
    </TD>
    <TD vAlign="middle" align="center" width="120" bgColor="#e1e1e1" height="10">
    数量
    </TD>
    <TD vAlign="middle" align="center" width="300" bgColor="#e1e1e1" height="10">
    检测部门
    </TD>
    <TD vAlign="middle" align="center" width="100" bgColor="#e1e1e1" height="10">
    强检
    </TD>
    <TD vAlign="middle" align="center" width="280" bgColor="#e1e1e1" height="10">
    承诺日期
    </TD>
    </TR>
    </TABLE>
    table后面的id不能省保存之前先通过循环把值取出来,放到隐藏字段部分代码如下:  for(var i=1;i<TableID.rows.length;i++)
                    {
                         var row=TableID.rows[i];
                         ReceiveForm.TxtInstrumentIdArray.value+=row.cells[1].innerText;
                         ReceiveForm.TxtInstrumentNameArray.value+=row.cells[2].innerText;                    
                         ReceiveForm.TxtNumsArray.value +=row.cells[3].innerText;
                         ReceiveForm.TxtCheckDepartmentIdArray.value +=row.cells[4].getElementsByTagName("SELECT")[0].value;
                         ReceiveForm.TxtQjArray.value +=row.cells[5].getElementsByTagName("INPUT")[0].checked;
                         ReceiveForm.TxtDateArray.value +=row.cells[6].innerText;
                         if (i<TableID.rows.length-1)
                         {
                            ReceiveForm.TxtInstrumentIdArray.value+=",";
                            ReceiveForm.TxtInstrumentNameArray.value+=",";                                       
                            ReceiveForm.TxtNumsArray.value +=",";
                            ReceiveForm.TxtCheckDepartmentIdArray.value +=",";
                            ReceiveForm.TxtQjArray.value +=",";
                            ReceiveForm.TxtDateArray.value +=",";
                         }
                    }
    服务端用split函数分解隐藏字段,然后通过循环插入值
    我毕业设计用struts  spring  hibernate 实现的,这一块JS脚本花的时间是最多的
      

  5.   

    楼主不是这个意思吧。
    楼主是问如何动态添加Struts标签吧。这个基本上不能。