看到楼主的需求感觉很难 请你说明简化下。。

解决方案 »

  1.   

        <script language="javascript" type="">
    var FCcount=1;
    function findObj(theObj, theDoc)
    {
      var p, i, foundObj;
     
      if(!theDoc) theDoc = document;
      if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
      {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
      }
      if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
      for (i=0; !foundObj && i < theDoc.forms.length; i++)
    foundObj = theDoc.forms[theObj];
      for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
    foundObj = findObj(theObj,theDoc.layers.document);
      if(!foundObj && document.getElementById) 
                                foundObj = document.getElementById(theObj);
     
      return foundObj;
    } //添加一个参与人填写行
    function AddFSignRow(){
     //读取最后一行的行号,存放在txtTRLastIndex文本框中 
     var txtTRLastIndex = findObj("FtxtTRLastIndex",document);
     var rowID = parseInt(txtTRLastIndex.value);
     var signFrame = findObj("FSignFrame",document);
     var newTR = signFrame.insertRow(signFrame.rows.length);
     newTR.id = "FSignItem" + rowID;
     
     //添加列:序号
     var newNameTD=newTR.insertCell(0);
     //添加列内容
    var stre="<div style='padding-left:15px;'><table cellpadding=0 cellspacing=0><tr><tr><td class='td_left'>段位:</td><td class='td_center'><input id='SectionSeat"+ rowID +"' name='SectionSeat' class='textshort' /></td></tr>";
                            stre+="<tr><td class='td_left'>播放时段:</td><td class='td_center'><input id='time"+ rowID +"' name='time' type='text' class='textshort' onblur='ctime()' />例如20:50-21:00<span style='color: Red;'>* </span><span id='spanctime' class='default'></span></td><td class='td_right'></td></tr>";
                            stre+="<tr><td class='td_left'>播出形式:</td><td class='td_center'><%#GetTVType() %><span style='color: Red;'>*</span></td><td class='td_right'><span class='default' id='spanPlayForm"+ rowID +"'></span></td></tr>";
                            stre+="<tr><td class='td_left'>段位说明:</td><td class='td_center'><input type='text' class='textlong' id='Caption"+ rowID +"' name='Caption_NaN' onblur='cCaption()' /><span style='color: Red;'>*</span></td><td class='td_right'><span id='spanCaption"+ rowID +"' class='default'></span></td></tr>";
     stre+="<tr><td class='td_left'>播出时长:</td><td class='td_center'><input id='PLength1"+ rowID +"' name='PLength' type='text' class='textshort' onblur='cPLength()' /><selectid='Lengthsize1"+ rowID +"' name='Lengthsize' class='select'><option value='秒'>秒</option><option value='分'>分</option></select><span style='color: Red;'>* </span>例如 5秒</td><td class='td_right'><span class='default' id='spanPLength1"+ rowID +"'></span></td></tr>";
                            stre+="<tr><td class='td_left'>刊例价:</td><td class='td_center'><input type='text' class='textshort' id='Rate1"+ rowID +"' name='Rate_NaN' onblur=check('Rate1"+ rowID +"','spanRate1"+ rowID +"') />元<span style='color: Red;'>*</span></td><td class='td_right'><span class='default' id='spanRate1"+ rowID +"'></span></td></tr>";
                        stre+="<tr><td class='td_left'>王者价:</td><td class='td_center'><input type='text' class='textshort' id='Kad1"+ rowID +"' name='Kad_NaN' onblur=check1('Rate1"+ rowID +"','Kad1"+ rowID +"','spanKad1"+ rowID +"') />元<span style='color: Red;'>*</span></td><td class='td_right'><span class='default' id='spanKad1"+ rowID +"'></span></td></tr>";
                            stre+="<tr><td class='td_left'>结算价:</td><td class='td_center'><input type='text' class='textshort' id='Low1"+ rowID +"' name='Low_NaN' onblur=check2('Kad1"+ rowID +"','Low1"+ rowID +"','Royalty1"+ rowID +"','spanLow1"+ rowID +"') />元<span style='color: Red;'>*</span></td><td class='td_right'><span class='default' id='spanLow1"+ rowID +"'></span></td></tr>";
    stre+="<tr><td class='td_left'>销售佣金:</td><td class='td_center'><input type='text' class='textshort' id='Royalty1"+ rowID +"' readonly='readonly' name='Royalty_NaN'/>元</td><td class='td_right'></td></tr>";
      stre+="</table></div>";
    newNameTD.innerHTML=stre.toString();
    newNameTD.width="600px";
     //添加列:删除按钮
     var newDeleteTD=newTR.insertCell(1);
     //添加列内容
     newDeleteTD.innerHTML = "<div align='center' style='width:40px;'><a href='javascript:;' onclick=\"DeleteFSignRow('FSignItem" + rowID + "')\">删除</a></div>";
     
     //将行号推进下一行
     txtTRLastIndex.value = (rowID + 1).toString() ;
     FCcount++; var strcount=document.getElementById("Fcountnum");
    strcount.value=FCcount;
    } //删除指定行
    function DeleteFSignRow(rowid){
     var signFrame = findObj("FSignFrame",document);
     var signItem = findObj(rowid,document);
     
     //获取将要删除的行的Index
     var rowIndex = signItem.rowIndex;
     
     //删除指定Index的行
     signFrame.deleteRow(rowIndex);
     
     //重新排列序号,如果没有序号,这一步省略
     for(i=rowIndex;i<signFrame.rows.length;i++){
      signFrame.rows.cells[0].innerHTML = i.toString();
     } FCcount--;
    var strcount=document.getElementById("Fcountnum");
    strcount.value=FCcount;
    }
    function show()
    {
    var shco=document.getElementById("Fcountnum");
    alert(shco.value);
    }
                    </script>                <tr>
                        <td colspan="3">
                            <table border="0" cellpadding="0" cellspacing="0" id="FSignFrame">
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <input type="button" name="Submit" value="添加多个段位" onclick="AddFSignRow()" style="margin-left: 150px;" />
                            <input name='txtTRLastIndex' type='hidden' id='FtxtTRLastIndex' value="1" class="textshort" />
                            <input name="countnum" type="hidden" id="Fcountnum" value="1" class="textshort" />
                        </td>
                    </tr>这是我创建单层的表格循环所使用的代码,是另外一位Csdn上的大哥帮忙解决的。可是现在需求变了,我需要在这个循环的外面,在加上一层的循环创建,这样我就没有办法了
    希望能够请各位帮帮忙!
      

  2.   

    楼主你的表达还是有问题 你就说加循环 我们怎么知道 你要实现什么功能阿你就说你的需求 想实现什么样式