日期:2014-05-17 浏览次数:20670 次
<script type="text/javascript">
function upd(?){
}
</script>
</head>
<body>
<table id="table1" border="1px">
<tr style="text-align:center; font-weight:bold;">
<td>商品名称</td>
<td>数量</td>
<td>单价</td>
<td>操作</td>
</tr>
<tr id="tr2">
<td>玫瑰保湿睡眠面膜</td>
<td>5</td>
<td>¥48</td>
<td><input type="button" value="删除" onclick="dele('tr2')"/>
<input id="t1" type="button" value="修改" onchange="upd(?)" /></td>
</tr>
<tr style="text-align:center">
<td colspan="4"><input type="button" value="增加订单" /></td>
</tr>
</table>
<html>
<head>
<script type="text/javascript">
function update(){
var cnt = document.getElementById("cnt");
cnt.innerHTML = "<input type='text' value=" + cnt.innerHTML + " id='cntInput' onchange='confirmUpdate()'/>";
}
function confirmUpdate(){
var r=confirm("确认修改!");
if (r){
//alert("You pressed OK!");
var newCnt = document.getElementById("cntInput").value;
//alert(newCnt);
var cnt = document.getElementById("cnt");
cnt.innerHTML = newCnt;
}
}
</script>
</head>
<body>
<table border="1">
<tr>
<td id="cnt">123</td>
</tr>
</table>
<br />
<input type="button" onclick=update()
value="修改" />
</body>
</html>