About elements display in named arrays
i have following code Now i want to display the elements in each place which are comma delimited in a table as for each delimited value in one cell.. means 01 in first cell ABC in second cell, MCA in third cell... how to split plz tell me.. thank you
function showData()
{
namedArray['id1']='01,ABC,MCA';
namedArray['id2']='02,DEF,MCA';
namedArray['id3']='03,GHI,MCA';
namedArray['id4']='04,JKL,MCA';
var i=0;
var length=0;
for (var obj in namedArray )
{
length++
}
alert(length);
//var x=namedArray['id2'];
//开发者_如何学Pythonalert(x);
var tabid=document.getElementById('mytable');
var tlength=tabid.rows.length;
i++;
var cell1=row.InsertCell(0);
var cell2=row.InsertCell(0);
var cell3=row.InsertCell(0);
var where_is_mytool="home/mytool/mytool.cgi";
var mytool_array=where_is_mytool.split("/");
<SCRIPT language="JavaScript">
<!--
function divide_string()
{
var where_is_mytool="home/mytool/mytool.cgi";
var mytool_array=where_is_mytool.split("/");
alert(mytool_array[0]+" "+mytool_array[1]+" "+mytool_array[2]);
}
//-->
</SCRIPT>
You can query the amount of split why using where_is_mytool.length
精彩评论