日期:2014-05-17  浏览次数:20633 次

HTML页面动态增加下拉列表,求定位删除方法
在页面上动态的增加下拉列表,也可以动态增加其他元素
缺点是删除的时候,只能从后往前删除,不知哪位大神有方法实现定位删除
<html>  
  <head>  
  <title>Untitled   Document</title>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <script   language="javascript">

      LastTableID = 0;

      function add() {
          LastTableID = LastTableID + 1;

          adTable = document.getElementById('atb_' + LastTableID);
          if (adTable != null) {
              adTable.style.display = "block";
          }
          else {
              str = '<table id="atb_' + LastTableID + '" style="display:block">';
              str = str + '<tr height="25"  align=center   valign=middle   bgcolor=#FFFFFF>';
              str = str + '<td  width="70"><select id="select1_' + LastTableID + '"></select></td>';
              str = str + '</tr></table>';
              window.upid.innerHTML += str + '';
          }
      }

      function dellast() {

          //alert(LastTableID);

          if (LastTableID > 0) {

              deleTable = document.getElementById('atb_' + LastTableID);

              if (deleTable != null) {

                  deleTable.style.display = "none";

                  LastTableID = LastTableID - 1;
              }
          }

      }                              
  </script>  
  </head>    
  <body>       7
  <form name="myform">      
        <table>      
                <tr>          
                        <td>    
                       &nb