<script type="text/javascript">
var reg_expression=/\d/;
function createinput()
{
if(document.form1.number.value==""||!(reg_expression.test(document.form1.number.value))){
window.alert("请输入数字");
return false;
}
document.getElementById("ok").disabled=true;
var symbol=false;
var idnumber=1;
for(var i=0;i<document.form1.number.value;i++)
{
symbol=true;
var table=document.createElement("table");
var tbody=document.createElement("tbody");
var tr=document.createElement("tr");
var td1=document.createElement("td");
var td2=document.createElement("td");
var td3=document.createElement("td");
var td4=document.createElement("td");
var input=document.createElement("input");
var input2=document.createElement("input");
input.type="text";
input.name="data"+idnumber;
input2.type="text";
input2.name="data2"+idnumber;
table.align="center";
td1=document.createTextNode("长度:");
td3=document.createTextNode("根数:");
td2.appendChild(input);
td4.appendChild(input2);
tr.appendChild(td1);
tr.appendChild(td2);
tr.appendChild(td3);
tr.appendChild(td4);
tbody.appendChild(tr);
table.appendChild(tbody);
idnumber++;
document.form1.appendChild(table);
}
if(symbol){
var button=document.createElement("input");
button.type="button";
button.onclick=function(){calculation()};
button.value="计算";
document.form1.appendChild(button);
}
return ture;
}
}
</script>