从一个页面把值传到另一个页面,要把值在表格里边显示出来,表格是动态生成的; 代码如下:

生成一行的代码,要把值传过来之后,显示在表格,点击图中添加商品按钮,就会执行addItem()函数,然后把从另一个页面的传过来,显示在表格里边,functionaddIt... 生成一行的代码,要把值传过来之后,显示在表格,点击图中添加商品按钮,就会执行addItem()函数,然后把从另一个页面的传过来,显示在表格里边,
function addItem(){
var detailList = document.getElementById("detailList");
var i=detailList.rows.length;

var row = detailList.insertRow(i);
var rowIndex = detailList.rows[i].rowIndex;
var j=k;

detailList.rows[i].setAttribute("align","center");
detailList.rows[i].setAttribute("bgcolor","#FFFFFF");
detailList.rows[i].setAttribute("id","tr"+j);

detailList.rows[i].insertCell(0);

var text = document.createTextNode(rowIndex-1);
detailList.rows[i].cells[0].appendChild(text);

detailList.rows[i].insertCell(1);
var input10 = document.createElement("input");
input10.setAttribute("type","hidden");
input10.setAttribute("name","productId");
input10.setAttribute("id","productId"+j);
detailList.rows[i].cells[1].appendChild(input10);
var input1 = document.createElement("input");
input1.setAttribute("type","text");
input1.setAttribute("size","30");
input1.setAttribute("name","productName");
input1.setAttribute("disabled","true");
input1.setAttribute("id","productName"+j);
detailList.rows[i].cells[1].appendChild(input1);
var input8 = document.createElement("input");
input8.setAttribute("type","button");
input8.setAttribute("value","选择商品");
input8.onclick= selectProduct;
detailList.rows[i].cells[1].appendChild(input8);

detailList.rows[i].insertCell(2);
var input20 = document.createElement("input");
input20.setAttribute("type","hidden");
input20.setAttribute("name","shelfId");
input20.setAttribute("id","shelfId"+j);
detailList.rows[i].cells[2].appendChild(input20);
var input2 = document.createElement("input");
input2.setAttribute("type","text");
input2.setAttribute("size","25");
input2.setAttribute("name","shelfName");
input2.setAttribute("disabled","true");
input2.setAttribute("id","shelfName"+j);
detailList.rows[i].cells[2].appendChild(input2);
var input9 = document.createElement("input");
input9.setAttribute("type","button");
input9.setAttribute("value","选择货架");
input9.onclick= selectShelf;
detailList.rows[i].cells[2].appendChild(input9);

detailList.rows[i].insertCell(3);
var input3 = document.createElement("input");
input3.setAttribute("type","text");
input3.setAttribute("size","26");
input3.setAttribute("name","qty");
detailList.rows[i].cells[3].appendChild(input3);

detailList.rows[i].insertCell(4);
detailList.rows[i].cells[0].setAttribute("height","25");
var deleteRow = document.createElement("a");
deleteRow.setAttribute("href","javascript:deleteItem("+j+")");
deleteRow.appendChild(document.createTextNode("删除"));
detailList.rows[i].cells[4].appendChild(deleteRow);
展开
 我来答
ztw1122
2012-06-18 · TA获得超过1088个赞
知道小有建树答主
回答量:2382
采纳率:80%
帮助的人:927万
展开全部
jsp 我在知道没见人会
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式