日期:2014-05-16  浏览次数:20331 次

这段代码看不懂,请大家帮忙看看,谢谢
请问要怎样从
c0.innerHTML= " <input   size=10   class=noborder   name=sCatalog "+allCount+ "> ";
里得到   input   的值啊,请帮帮小弟,谢谢了
<script   language=javascript>
function   tick()
{
  theform.plswait.value=theform.plswait.value+ '. ';
  window.setTimeout( "tick() ",1000);
}
allCount=0;
function   addline()
{
  newRow=datatable.insertRow(datatable.rows.length);
  newRow.ln=allCount;
  newRow.id= "line "+allCount;
  c0=newRow.insertCell(0);
  c0.bgColor= "#FFFFFF ";
  c0.innerHTML= " <input   size=10   class=noborder   name=sCatalog "+allCount+ "> ";
  c1=newRow.insertCell(1);
  c1.bgColor= "#FFFFFF ";
  c1.innerHTML= " <input   size=12   class=noborder   name=sClass "+allCount+ "> ";
  c2=newRow.insertCell(2);
  c2.bgColor= "#FFFFFF ";
  c2.innerHTML= " <input   size=8   class=noborder   name=sMaterial "+allCount+ "> ";
  allCount++;
}


------解决方案--------------------
请问要怎样从
c0.innerHTML= " <input size=10 class=noborder name=sCatalog "+allCount+ "> ";

这里面没有值,他只是生成了一个 text控件,如果生成页面后,在text输入东西
可以
document.getElementsByName( "sCatalo0 ")[0].value
document.getElementsByName( "sCatalo1 ")[0].value
还可以
var a=document.getElementsByTagName( "input ")
for(var =0;i <a.length;i++){
if(a[i].type== "text "){
if(a[i].name.substr(0,7)== "sCatalo "){
alert(a[i].value)
}
}
}