表格明细赋值问题 本帖最后由 shijie_nanjing 于 2012-07-19 14:30:13 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 深度克隆节点就会连事件一起克隆了,不过你的事件是按照ID来设置,帮你改成按照节点关系来来设置了<html><head><title>my pages</title><script type="text/javascript" language="JavaScript"> var indexNumber = "01"; var clothePrice = new Array(4); clothePrice[0] = 0; clothePrice[1] = 1; clothePrice[2] = 2; clothePrice[3] = 3; clothePrice[4] = 4; clothePrice[5] = 5; clothePrice[6] = 6; clothePrice[7] = 7; function onTypeChange(o) { var index = o.selectedIndex; var text = clothePrice[index]; var tr = o.parentNode.parentNode; //document.getElementById("cost_Price").value = text; tr.cells[3].getElementsByTagName('input')[0].value = text; if (tr.cells[4].getElementsByTagName('input')[0].value != "") { onGetPrice(); } } function onGetPrice(o) { var tr = o.parentNode.parentNode, sold_price = parseInt(o.value,10); var cost_Price = parseInt(tr.cells[3].getElementsByTagName('input')[0].value, 10); //document.getElementById("get_Price").value = sold_price - cost_Price; tr.cells[5].getElementsByTagName('input')[0].value = sold_price - cost_Price; } function addaction() { document.getElementById("net").value = 1000; } function addRow() { var tr = document.getElementById('trTpl').cloneNode(true);///////// tr.removeAttribute('id'); document.getElementById('tbList').appendChild(tr) tr.cells[1].innerHTML = tr.parentNode.rows.length < 10 ? '0' + tr.parentNode.rows.length.toString() : tr.parentNode.rows.length; }</script></head><body><div><table class="button"><tr><td><button type = "button" onclick="addRow()">Click me!</button></td></tr></table></div><div><table><tr><td align="center">Date</td><td align="center">Number</td><td align="center">Style</td><td align="center">Cost</td><td align="center">SoldPrice</td><td align="center">Profit</td></tr><tbody id="tbList"><tr id="trTpl"><td><input type="text" name="sold_Date" id="sold_Date" /></td><td align="right"><label for="">01</label></td><td width="100px"><select type="select" name="type" id="type" onchange="onTypeChange(this);"><option value="0">type</option><option value="1">A</option><option value="2">B</option><option value="3">C</option><option value="4">D</option><option value="5">E</option><option value="6">F</option><option value="7">G</option></select></td><td align="right"><input type="text" name="cost_Price" id="cost_Price" readonly="true"/></td><td align="right"><input type="text" name="sold_Price" id="sold_Price" onchange="onGetPrice(this);"/></td><td align="right"><input type="text" name="get_Price" id="get_Price" /></td></tr></tbody><tr><td colspan="7"></td><td align="right"><button type = "button" onclick="addaction()">NET</button></td><td><input type="text" name="net" id="net" readonly="true"></label></td></tr></table></div></body></html> 困扰了一个晚上的问题,实在想不懂!关于用JS提交表单 一个抽奖程序的问题。 带参数方法的回调怎么去实现 怎样从一个子frame中取得另一个子frame中的标签? 正则表达式验证问题 通过JScript创建和更新cookie,并保存。该如何实现? 当我把checkbox 打上勾时,为什么上面的总押金和租金的值都没有改变! [发布]文件名操作类 用xmlhttp发post时已经把ie浏览器的安全设置为"中-低"为什么还有安全提示,怎么设置取消? 请问如何点击一个链接后刷新本页面 jquery mobile 加载两次 请教一个关于IE6下jQuery修改图片src属性不能改变图片的问题。
<head>
<title>my pages</title>
<script type="text/javascript" language="JavaScript">
var indexNumber = "01";
var clothePrice = new Array(4);
clothePrice[0] = 0;
clothePrice[1] = 1;
clothePrice[2] = 2;
clothePrice[3] = 3;
clothePrice[4] = 4;
clothePrice[5] = 5;
clothePrice[6] = 6;
clothePrice[7] = 7; function onTypeChange(o) {
var index = o.selectedIndex;
var text = clothePrice[index];
var tr = o.parentNode.parentNode;
//document.getElementById("cost_Price").value = text;
tr.cells[3].getElementsByTagName('input')[0].value = text;
if (tr.cells[4].getElementsByTagName('input')[0].value != "") {
onGetPrice();
}
} function onGetPrice(o) {
var tr = o.parentNode.parentNode, sold_price = parseInt(o.value,10);
var cost_Price = parseInt(tr.cells[3].getElementsByTagName('input')[0].value, 10);
//document.getElementById("get_Price").value = sold_price - cost_Price;
tr.cells[5].getElementsByTagName('input')[0].value = sold_price - cost_Price;
} function addaction() {
document.getElementById("net").value = 1000;
}
function addRow() {
var tr = document.getElementById('trTpl').cloneNode(true);/////////
tr.removeAttribute('id');
document.getElementById('tbList').appendChild(tr)
tr.cells[1].innerHTML = tr.parentNode.rows.length < 10 ? '0' + tr.parentNode.rows.length.toString() : tr.parentNode.rows.length;
}
</script>
</head>
<body>
<div>
<table class="button">
<tr>
<td>
<button type = "button" onclick="addRow()">Click me!</button>
</td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<td align="center">
Date
</td>
<td align="center">
Number
</td>
<td align="center">
Style
</td>
<td align="center">
Cost
</td>
<td align="center">
SoldPrice
</td>
<td align="center">
Profit
</td>
</tr>
<tbody id="tbList">
<tr id="trTpl">
<td>
<input type="text" name="sold_Date" id="sold_Date" />
</td>
<td align="right">
<label for="">01</label>
</td>
<td width="100px">
<select type="select" name="type" id="type" onchange="onTypeChange(this);">
<option value="0">type</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
<option value="4">D</option>
<option value="5">E</option>
<option value="6">F</option>
<option value="7">G</option>
</select>
</td>
<td align="right">
<input type="text" name="cost_Price" id="cost_Price" readonly="true"/>
</td>
<td align="right">
<input type="text" name="sold_Price" id="sold_Price" onchange="onGetPrice(this);"/>
</td>
<td align="right">
<input type="text" name="get_Price" id="get_Price" />
</td>
</tr></tbody>
<tr>
<td colspan="7">
</td>
<td align="right">
<button type = "button" onclick="addaction()">NET</button>
</td>
<td>
<input type="text" name="net" id="net" readonly="true"></label>
</td>
</tr>
</table>
</div>
</body>
</html>