哪个大哥大姐帮我写下这个代码的注释好不???我刚开始学java,这写都看不懂..求大家帮我写下注释,帮我解释下代码的意思.谢谢了!!!
var dataArray = new Array();
dataArray[0] = "1|0|A ";
dataArray[1] = "2|0|B ";
dataArray[2] = "3|0|C ";
dataArray[3] = "4|0|D ";
dataArray[4] = "5|1|AA ";
dataArray[5] = "6|1|AA1 ";
dataArray[6] = "7|1|AA2 ";
dataArray[7] = " 8-|1|AA2 ";
dataArray[8] = "9|5|AAA ";
dataArray[9] = "10|9|AAAA ";
//取得下来选择框的容器
var selWarpper = $( " ");
/**
* 初始化下拉选框,可以设置选中的项,要设置选中的话,就把要选中的项的值传进来
* @param {Object} parentid 父级编号
* @param {Object} selID select的id
* @param {Object} value select选种的值,有值的话,相等就会被选种,没有的话输入“”
*/
function initSel(parentid,selID,value)
{
var sel = $(selID);
//元素不存在就创建
if(!sel)
{
sel = document.createElement( "SELECT ");
sel.id = selID;
sel.name = selID;
selWarpper.appendChild(sel);
}
sel.onchange($(selID).value,parseInt(selID)+1, " ");
var valueArray;
var option = document.createElement( "OPTION ");
option.value = " ";
option.text = "--请选择-- ";
sel.add(option);
var toCount = 0;
for(var i = 0;i <dataArray.length;i++)
{
valueArray = dataArray[i].split( "| ");
if(parseInt(valueArray[1] == parentid))
{
var option = document.createElement( "OPTION ");
option.value = valueArray[0];
option.text = valueArray[2];
if(value)
{
if(parseInt(value)==valueArray[0])
option.selected = true;
}
sel.add(option);
toCount++;
}
}
//没有选项就移除此下拉框
if(toCount == 0)
selWarpper.removeChild(sel);
}
function setSub(parentid,selID,value)
{
var sel = $(selID);
//元素不存在就创建
if(!sel)
{
sel = document.createElement( "SELECT ");
sel.id = selID;
sel.name = selID;
selWarpper.appendChild(sel);
}
removeOptions(sel);
sel.onchange($(selID).value,parseInt(selID)+1, " ");
var valueArray;
var toCount = 0;
var option = document.createElement( "OPTION ");
option.value = " ";
option.text = "--请选择-- ";
sel.add(option);
for(var i = 0;i <dataArray.length;i++)