try:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function addRow() {
myTable.outerHTML=myTable.outerHTML.match(/(<[^>]*>)/)[0]+myTable.innerHTML+(myTable.rows[myTable.rows.length-1].outerHTML)+'</table>'
with(myTable.rows[myTable.rows.length-1]){
cells[0].innerText++;
cells[1].firstChild.value=Number(cells[1].firstChild.value)+100
cells[2].firstChild.value=Number(cells[2].firstChild.value)+100
}
}
function chkRowNum(){
var e=window.event.srcElement
var i=e.parentElement.cellIndex,r=e.parentElement.parentElement.rowIndex; 
if(r==myTable.rows.length-1){addRow();myTable.rows[myTable.rows.length-2].cells[i].children[0].select();}
}
</SCRIPT></head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<table width="98%" border="1" cellspacing="0" cellpadding="0" bordercolor="#ffcc00" align="center" id="myTable">
<th>n<th>开始<th>结束<th>价格</th>
<tr>
<td>1
<td><input type=text name=r1c1 size=20 onfocus="chkRowNum()" value=1>
<td><input type=text name=r1c2 size=20 value=100>
<td><input type=text name=r1c3 size=30>
</tr>
</table>
<input type=button onclick="addRow()" value=新增>
</form>
</body>
</html>

解决方案 »

  1.   

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE></TITLE>
    <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
    <!--function button1_onclick() {
    var i = document.all.uprange.length;
    if (i==null)
    {
    i=1;
    }
    if (i==1)
    {
    var l = document.all.uprange.value;
    }
    else
    var l = document.all.uprange[i-1].value;
    if (l==""||isNaN(l))
    {
    l=0;
    }else
    l= parseFloat(l);l=l+1;var res ="";res+="<input type=\"text\" value="+l+" name=\"downrange\">到";
    res +="<input type=\"text\" name=\"uprange\"> 价格";
    res +="<input type=\"text\" name=\"unitprice\">";document.all.div1.innerHTML 2B=res;
    }//-->
    </SCRIPT>
    </HEAD>
    <BODY><P>&nbsp;</P>
    <div id="div1">
    <input type="text" name="downrange" value="1">到<input value="100" type="text" name="uprange"> 价格<input type="text" name="unitprice"></div>
    <INPUT type="button" value="Add" id=button1 name=button1 LANGUAGE=javascript onclick="return button1_onclick()">
    </BODY>
    </HTML></慕白兄>