关闭

想问一下,怎么样才能在点完删除按钮后,把值从1再按顺序排一下呢,

448人阅读 评论(0) 收藏 举报

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 2</title>
</head>
<body>
<script>
var j=0
function add_row(){
 j=sqd.rows.length;
 newRow=document.all.sqd.insertRow(-1)
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML=j
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=SerialNumber type=radio value="+j+">"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=SerialNumber1 type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=ProductName type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=jianshu type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=Quantity type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=GrossWeight type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=CountWeight type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=UnitPrice type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=Amount type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=CustOrder type=text class=INPUT1 size=3>"
 newcell=newRow.insertCell()
 newcell.style.backgroundColor='#f7f7f7'
 newcell.innerHTML="<input name=Discription type=text class=INPUT1 size=3>"
}
function del_row() {
 if(sqd.rows.length==1) return;
 var checkit = false
 for (var i=0;i<document.all.SerialNumber.length;i++) {
  if (document.all.SerialNumber[i].checked) {
  checkit=true;
  sqd.deleteRow(i+1)
  break;
  }
 }
 if (checkit) {return true} else {alert("please select one");return false}
 
}
function re(){
for (p=1;p<sqd.getElementsByTagName('tr').length;p++){
sqd.getElementsByTagName('tr')[p].getElementsByTagName('td')[0].innerText=p;}
}
</script>
<table id="sqd" width="90%" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
              <tr bgcolor="#BAC2DA">
                <td height="25"> <div align="center">序号</div></td>
                <td> <div align="center">选中</div></td>
                <td> <div align="center">货物编号</div></td>
                <td> <div align="center">货物品名</div></td>
                <td> <div align="center">件数</div></td>
                <td> <div align="center">数量</div></td>
                <td> <div align="center">毛重</div></td>
                <td> <div align="center">计货重量</div></td>
                <td> <div align="center">费率</div></td>
                <td> <div align="center">金额</div></td>
                <td> <div align="center">客户定单号</div></td>
                <td> <div align="center">备注</div></td>
              </tr>
             </table>
            <br> <input name="Submit5" type="button" onClick=add_row() class="button" value=" 添 加 ">
            <input name="Submit33" onclick=del_row();re() type="button" class="button" value=" 删 除 ">
</body>
</html>

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:350076次
    • 积分:6562
    • 等级:
    • 排名:第3630名
    • 原创:297篇
    • 转载:39篇
    • 译文:0篇
    • 评论:58条
    文章分类
    最新评论