op.sclassnumber.options.add(new Option(secondMenuClassNumber[0]+":"+secondMenuText[0]),secondMenuClassNumber[0]);
//====================
new option(text,value,defaultSelected,selected)
text:字符串,指定option对象的text属性(即<option></option>之间的文字)
value:字符串,指定option对象的value属性
defaultSelected:布尔值,指定option对象的defaultSelected属性
selected:布尔值,指定option对象的selected属性
//===================
function getDatas()
{
index=document.all.sclassnumber.options.length
for(i=0;i<index;i++)
{
document.all.sclassnumber.remove(0);//因为每删除一个option,则索引就改变
}
//========
var op = document.materialAdd;
var classid=op.classnumber.value;
//alert(classid)
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load("menuData.asp?classid="+classid)
nodes=xmlDoc.documentElement.childNodes
//alert(nodes(1).childNodes(0).text)
secondMenuClassNumber=new Array()
secondMenuText=new Array();
//alert(nodes.length)
for(i=0;i<nodes.length;i++)
{
//var sclassNumber=nodes(i).childNodes(0).text
//var sclassName=nodes(i).childNodes(1).text
secondMenuClassNumber.push(nodes(i).childNodes(0).text)
secondMenuText.push(nodes(i).childNodes(1).text)
}
//alert(secondMenuClassNumber[0])
//alert(secondMenuText[0])
//op.sclassnumber.add(new Option(secondMenuText[0]),secondMenuClassNumber[0]);
secondMenuClassNumber.unshift("")
secondMenuText.unshift("--请选择--")
//alert(secondMenuText[0])
for(i=0;i<secondMenuText.length;i++)
{
document.all.sclassnumber.options[i] = new Option(secondMenuClassNumber[i]+" "+secondMenuText[i],secondMenuClassNumber[i]);
}
}