javascript - 动态添加瓦片到jsp页面
问题描述
我是 struts-1 和瓷砖的新手。我遇到的问题是动态地将图块添加到表中。谁能指出我正确的方向
myTestTable.jsp //带有表格和脚本的jsp页面添加新行
<table id="testing" style="padding-top: 10px">
<thead>
<tr>
<th>Student Name</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="javascript:void(0);" class="addCF">Add</a></td>
<td>
<tiles:insert definition=".textInput">
<tiles:put name="property" value="parameter[01]"/>
<tiles:put name="width" value="75"/>
</tiles:insert>
</td>
<tr>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function(){
$(".addCF").click(function(){
$("#testing").append('<tr><td>
<tiles:insert definition=".textInput">
<tiles:put name="property" value="parameter[02]"/>
<tiles:put name="width" value="75"/>
</tiles:insert></td> </tr>');
});
});
</script>
这是添加另一行瓷砖的正确方法吗?还是有更好的方法来解决这个问题?它必须是每次用户单击添加按钮时,所以可能是 1 或 20。
解决方案
推荐阅读
- javascript - 比较数组javascript时找到最接近的匹配项
- python - Tensorflow DNNClassifier 错误:[Labels must <= n_classes - 1] [Condition x <= y did not hold element-wise:x
- c++ - 我的 OpenGL QQuickItem 没有我想要的大小
- javascript - 跨 SuiteScript 2.0 map/reduce 阶段持久化数据
- perl - Strawberry Perl 和 IIS 看似已配置,但收到 404 页面
- r - sum(is.na(df$x) 给我的答案与 dplyr df%>%filter(x==NA) 不同
- php - 根据总分和时间获取用户排名位置
- python - 使用 Django 从本地主机获取 AuthException 的 Google OAuth 身份验证
- python - 将值添加到使用 csv_read 导入的 DASK 数据帧列
- r - R中的应用函数会产生缺失值错误