求动态添加structs标签代码 在jsp页面上有一个按钮,点击一下添加一个<s:file>控件,如何实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Jquery:<body><input type="button" id="btn"/><script>$(document).ready(function() {$("#btn").click(function() {var str = "<s:file ............. />"$(this).after(str);});});</script></body>简单示意。。至于JS。好久不用了。。忘记怎么写了JQUERY王道 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>My JSP 'upload.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 br=document.createElement("br");var file=document.createElement("input");var button=document.createElement("input"); file.type="file"; file.name="file"; button.type="button"; button.value="remove"; button.onclick=function(){ td.removeChild(br); td.removeChild(file); td.removeChild(button); } td.appendChild(br); td.appendChild(file); td.appendChild(button);}</script> </head> <body> <s:form action="upload" theme="simple" enctype="multipart/form-data" method="post"> <table> <tr> <td>name</td> <td><s:textfield name="name" ></s:textfield></td> </tr> <tr> <td>pass</td> <td><s:textfield name="pass" ></s:textfield></td> </tr> <tr> <td>file</td> <td id="more"><s:file name="file" /><input type="button" value="more" onclick="addmore();"/></td> </tr> <tr> <td>submit</td> <td><s:submit name="submit"></s:submit></td> </tr> </table> </s:form> </body></html> Hibernate用Unique约束列做外键,如何配置? web开发中定时计划Quartz问题 hibernate缓存问题 推荐几个像SSH Secure Shell Client的工具。。。 部署问题,使用J2EE开发的一个简单网站 新手求教:java下调用命令行的代码!!谢谢!!! 能用javascript添加struts的标签吗? 对于DAO的困惑,请大家指教一下 jsp tag library出错,请高手帮帮忙 java application???帮帮小弟啊! 正则表达 怎么设计程序,才能保持数据的一致性?
<input type="button" id="btn"/><script>
$(document).ready(function() {
$("#btn").click(function() {
var str = "<s:file ............. />"
$(this).after(str);
});
});
</script>
</body>
简单示意。。
至于JS。好久不用了。。忘记怎么写了JQUERY王道
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'upload.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 br=document.createElement("br");
var file=document.createElement("input");
var button=document.createElement("input");
file.type="file";
file.name="file";
button.type="button";
button.value="remove";
button.onclick=function(){
td.removeChild(br);
td.removeChild(file);
td.removeChild(button);
}
td.appendChild(br);
td.appendChild(file);
td.appendChild(button);
}
</script>
</head>
<body>
<s:form action="upload" theme="simple" enctype="multipart/form-data" method="post">
<table>
<tr>
<td>name</td>
<td><s:textfield name="name" ></s:textfield></td>
</tr>
<tr>
<td>pass</td>
<td><s:textfield name="pass" ></s:textfield></td>
</tr>
<tr>
<td>file</td>
<td id="more"><s:file name="file" /><input type="button" value="more" onclick="addmore();"/></td>
</tr>
<tr>
<td>submit</td>
<td><s:submit name="submit"></s:submit></td>
</tr>
</table>
</s:form>
</body>
</html>