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

关于一个split的问题(在线等)
<js>
//////////
var   str00= "aa00|bb00|cc00 ";
var   arrLocation=str00.split( "| ");
for(var   i=0;i <arrLocation.length;i++)
{
alert(arrLocation[i]);//能得到aa00,bb00,cc00
alert(document.all.aa00.value);//能得到34
alert(document.all.arrLocation[i].value);//报错!


}
/////////////////
<input   type= "text "   name= "aa00 "   value= "34 ">  
<input   type= "text "   name= "bb00 "   value= "35 ">  
<input   type= "text "   name= "cc00 "   value= "36 ">  


///////////////////
那个老大帮帮忙,

------解决方案--------------------
var str00= "aa00|bb00|cc00 ";
var arrLocation=str00.split( "| ");
for(var i=0;i <arrLocation.length;i++)
{
alert(document.getElementById(arrLocation[i]).value);//报错!


}
/////////////////
<input type= "text " id= "aa00 " name= "aa00 " value= "34 ">
<input type= "text " id= "aa00 " name= "bb00 " value= "35 ">
<input type= "text " id= "aa00 " name= "cc00 " value= "36 ">
------解决方案--------------------
<input type= "text " id= "aa00 " name= "aa00 " value= "34 ">
<input type= "text " id= "aa00 " name= "bb00 " value= "35 ">
<input type= "text " id= "aa00 " name= "cc00 " value= "36 ">

<script type= "text/javascript ">
var str00= "aa00|bb00|cc00 ";
var arrLocation=str00.split( "| ");
for(var i=0;i <arrLocation.length;i++)
{
alert(document.getElementById(arrLocation[i]).value);
}
</script>

没错啊~