展开全部
html代码:
62616964757a686964616fe4b893e5b19e31333335333735
订单行号
工具代码
订货数量
单位编码
需求日期
默认子库
不含税价
实际价格
计划价格
备注
id="00" value="00001" readonly="readonly" />
id="01" οncοntextmenu="return false" οnmοusedοwn="rightclick(event,this)" />
id="02" />
id="03" οncοntextmenu="return false" οnmοusedοwn="rightclick(event,this)" />
id="04" οnclick="return showCalendar(this, '%Y/%m/%d');" />
id="05" />
id="05" />
id="07" />
id="08" />
JS脚本:
//插入表格行
function insertRow()
{
var checks = document.getElementsByName("check");
var t = checks.length;
var i = parseInt(checks[parseInt(t-1)].id, 10) + 1;
var polinenumber;
if (t == 0) {
polinenumber = "00001";
} else {
var prenumber = document.getElementById((i-1).toString() + "0").value;
polinenumber =("00000" + (parseInt(prenumber, 10) + 1).toString()).slice(-5);
}
var detailTable = document.getElementById("detailTable");
var newRow = detailTable.insertRow();
var cell1 = newRow.insertCell();
cell1.innerHTML = '';
var cell2 = newRow.insertCell();
cell2.innerHTML = '';
var cell3 = newRow.insertCell();
cell3.innerHTML = '';
var cell4 = newRow.insertCell();
cell4.innerHTML = '';
var cell5 = newRow.insertCell();
cell5.innerHTML = '';
var cell6 = newRow.insertCell();
cell6.innerHTML = '';
var cell7 = newRow.insertCell();
cell7.innerHTML = '';
var cell8 = newRow.insertCell();
cell8.innerHTML = '';
var cell9 = newRow.insertCell();
cell9.innerHTML = '';
var cell8 = newRow.insertCell();
cell8.innerHTML = '';
var cell9 = newRow.insertCell();
cell9.innerHTML = '';
}
//删除表格行
function deleteRow() {
var detailTable = document.getElementById("detailTable");
var checks = document.getElementsByName("check");
for (var i = checks.length - 1; i >= 0; i--) {
if (checks[i].checked) {
var index = checks[i].parentNode.parentNode.rowIndex;
if (checks.length > 1) {
detailTable.deleteRow(index);
} else {
alert("\u6700\u540e\u4e00\u884c\u4e0d\u80fd\u5220\u9664\uff01\uff01\uff01");
}
}
}
if (checks.length < parseInt(checks[parseInt(checks.length - 1, 10)].id, 10) + 1) {
for (var i = 1; i <= checks.length; i++) {
document.getElementById(checks[i-1].id + "0").value = ("00000" + i.toString()).slice(-5);
}
}
}
//重置索引
function resetIndex()
{
var inputs = document.getElementsByTagName("input");
for(var i=0;i
{
if(inputs[i].name.indexOf('podetails[')!=-1)
{
var index =inputs[i].parentNode.parentNode.rowIndex;
inputs[i].name = inputs[i].name.replace(/\d+/,index-1);
}
}
}
//全选
function checkAll(obj)
{
var checks = document.getElementsByName("check");
for(var i=checks.length-1;i>=0;i--)
{
checks[i].checked = obj.checked;
}
}
后台Java代码:
Form代码:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.smtcl.business.struts.form;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import com.muhe.tools.AutoArrayList;
import com.smtcl.business.beans.Podetail;
import com.smtcl.business.beans.Po;
/**
* MyEclipse Struts
* Creation date: 09-27-2010
*
* XDoclet definition:
* @struts.form name="poForm"
*/
@SuppressWarnings("unchecked")
public class PoForm extends ActionForm {
/**
*
*/
private static final long serialVersionUID = 1L;
/*
* Generated fields
*/
/** po property */
private Po po = new Po();
/** pod property */
private List podetails = new AutoArrayList(Podetail.class);
/*
* Generated Methods
*/
/**
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}
/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
public Po getPo() {
return po;
}
public void setPo(Po po) {
this.po = po;
}
public List getPodetails() {
return podetails;
}
public void setPodetails(List podetails) {
this.podetails.clear();
this.podetails = podetails;
}
}
/** po property */
private Po po = new Po();
/** pod property */
private List podetails = new AutoArrayList(Podetail.class);
/*
* Generated Methods
*/
处理动态提交的数据,具体方法根据业务需求自动手做。
public class PoAddAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
PoForm poForm = (PoForm) form;// TODO Auto-generated method stub
com.smtcl.business.beans.Po po = poForm.getPo();
List podetails = poForm.getPodetails();
System.out.println(po.getStorerkey());
System.out.println("------");
System.out.println(podetails.size());
return null;
}
}
已赞过
已踩过<
你对这个回答的评价是?
评论
收起