谁能给点思路?关于JS脚本问题 我制作了一个增加TEXT文本的按钮,按一下出现一个新的TEXT文本,文本里面可以填写信息.然后又制作了一个确认提交时信息汇总的框体 请问怎么在新的文本域填写的信息通过最后的确定按钮出现的信息汇总框体里面显示出来.即你多填了一条信息,最后的汇总信息框体多一条你刚才填写的信息.请各位高人指教,给个思路或来个代码都行.谢谢了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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"); <%@ 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>和你的要求差不多。 var str = document.document.getElementsByid("").value;//“”填写你动态添加的文本框的iddocument.document.getElementsByid("").innerText+=str; 请问那些 “怪异验证码字体”是怎么做的啊? 表单自动填充并自动登录 怎么取得163邮箱的通讯录地址 JS初学者的一个小问题! sturts 使用displaytag.tld 出错 涉及业务逻辑的验证应该写在Action层还是Service层? 怎样把文件上传到数据库,然后读出来 我郁闷!暴简单问题(中文字符),昨天这个问题给了100,今天在给100! 急急急,在线等 坐等大神求解答~~~~~ struts中checkbox如何选中 用过installshield的进
<!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");
<%@ 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>和你的要求差不多。
document.document.getElementsByid("").innerText+=str;