我制作了一个增加TEXT文本的按钮,按一下出现一个新的TEXT文本,文本里面可以填写信息.然后又制作了一个确认提交时信息汇总的框体 请问怎么在新的文本域填写的信息通过最后的确定按钮出现的信息汇总框体里面显示出来.即你多填了一条信息,最后的汇总信息框体多一条你刚才填写的信息.请各位高人指教,给个思路或来个代码都行.谢谢了.

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK" />
    <title>test</title>
    <style type="text/css">
    p{
    width:197px;
    }
    .s{
    margin-right:2px;
    width:147px;
    }
    .yc{
    display:none;
    }
    </style>
    </head><body>
    <form name="form1" action="" method="post">
    <p><input type="text" name="s" class="s"  /></p>
    <p class="yc">汇总: <input type="text" name="x" /></p>
    <input type="button" value="增加" onclick="add()"> <input type="button" value="汇总" onclick="str()" /> <input type="submit" value="提交" /></p>
    </form><script type="text/javascript">
    var p = document.form1.getElementsByTagName("p");
    function add(){
    var obj   = document.createElement("<input type=\"text\" name=\"s\">");
    p[0].appendChild(obj);
    }
    function str(){
    var svalue = "";
    var x = document.form1.x;
    var s = document.getElementsByName("s");
    for(i=0; i<s.length; i++){
    svalue += s[i].value;
    }
    x.value = svalue;
    p[1].style.display = "block";
    }
    </script>
    </body>
    </html>
    后台接收: String value = request.getParameter("x");
      

  2.   

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%@ taglib prefix="s" uri="/struts-tags"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
    + request.getServerName() + ":" + request.getServerPort()
    + path + "/";
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>"> <title>My JSP 'upload2.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    --> <script type="text/javascript">
    function addMore(){
    var td = document.getElementById("more");
    var input = document.createElement("input");
    var remove = document.createElement("input");
    var br=document.createElement("br");
    input.type="file";
    input.name="file1"; 
    remove.type="button";
    remove.value="remove";

    td.appendChild(br);
    td.appendChild(input);
    td.appendChild(remove);
    remove.onclick=function(){
    td.removeChild(input);
    td.removeChild(remove);
    td.removeChild(br);
    }

    }
    </script>
    </head> <body>
    This is my JSP page.<hr>
    <h1><s:a href="download.action?">DOWNLOAD</s:a></h1>
    <br>
    <s:fielderror></s:fielderror> <hr>
    <s:form theme="simple" enctype="multipart/form-data" action="upload">
    <table>
    <tr>
    <td>
    username:
    </td>
    <td>
    <s:textfield name="username"></s:textfield>
    </td>
    </tr>
    <tr>
    <td>
    password:
    </td>
    <td>
    <s:textfield name="password"></s:textfield>
    </td>
    </tr>

    <tr>
    <td>
    File:
    </td>
    <td id="more">
    <s:file name="file1"></s:file>
    <input type="button" value="addMore.." onclick="addMore()">
    </td>
    </tr>
    <tr>
    <td colspan=2>
    <s:submit></s:submit>
    </td>
    </tr>
    </table> </s:form> </body>
    </html>和你的要求差不多。
      

  3.   

    var str = document.document.getElementsByid("").value;//“”填写你动态添加的文本框的id
    document.document.getElementsByid("").innerText+=str;