日期:2014-05-19 浏览次数:20814 次
var xmlHttp; function createXMLHttp() { if(window.XMLHttpRequest) { xmlHttp=new XMLHttpRequest(); } else { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } function findSubTypes(tid) { createXMLHttp(); xmlHttp.open("POST","ProductServlet?status=findbytypes&tid="+tid); xmlHttp.onreadystatechange=findSubTypesCallBack; xmlHttp.send(null); } function findSubTypesCallBack() { if(xmlHttp.readyState==4&&xmlHttp.status==200) { var allSubTypes=xmlHttp.responseXML.getElementsByTagName("subtypes")[0].childNodes; var select=document.getElementById("subtypes"); select.length=1; select.options[0].selected=true; for(var i=0;i<allSubTypes.length;i++) { var subtype=allSubTypes[i]; var option=document.createElement("option"); var stid=subtype.getElementsByTagName("stid")[0].firstChild.nodeValue; var title=subtype.getElementsByTagName("title")[0].firstChild.nodeValue; option.setAttribute("value",stid); option.appendChild(document.createTextNode(title)); select.appendChild(option); } } }