一拖三下拉菜单(js+xml+asp)
<script>var m_oXMLDoc = new ActiveXObject("Microsoft.XMLDOM");
//--------------cid为父级ID
var m_sBaseSrc = "Tree.asp?cid=";
//---------------id 为所属类型-----
var m_sBaseSrc1 = "&id=";
var m_post=3;
function BindSelect( strXMLSrc , objSelectName, defaultVal)
{
m_oXMLDoc.async = true;
m_oXMLDoc.onreadystatechange = Function( "fnLoadComplete('" + objSelectName + "', '" + defaultVal + "');" );
if (objSelectName=="jz_3"){ strXMLSrc=strXMLSrc+m_sBaseSrc1+0;}
if (objSelectName=="jz_25"){ strXMLSrc=strXMLSrc+m_sBaseSrc1+1;m_post=2;}
if (objSelectName=="jz_9"){ strXMLSrc=strXMLSrc+m_sBaseSrc1+2;}
if (objSelectName=="jz_10"){ strXMLSrc=strXMLSrc+m_sBaseSrc1+3;}
m_oXMLDoc.load( strXMLSrc );
}
function fnLoadComplete(objSelectName, defaultVal)
{
var objSelect = document.all[objSelectName];
var aryXMLNodes;
var node;
if (objSelect == null)
return;
try
{
var iReadyState = m_oXMLDoc.readyState;
}
catch(e)
{
return;
}
if( iReadyState != 4 ) return;
if( m_oXMLDoc != null && m_oXMLDoc.xml != "" )
{
objSelect.length = 0;
aryXMLNodes = m_oXMLDoc.documentElement.selectNodes("Tree_0");
objSelect.options[0] = new Option("==请选择==");
for (var i=0; i < aryXMLNodes.length; i++)
{
node = aryXMLNodes[i];
objSelect.options[i+1] = new Option(node.getAttribute("Title"),node.getAttribute("cId"));
//-------------------请注意这里,初始选择
if (node.getAttribute("cId")==1||node.getAttribute("cId")==2||node.getAttribute("cId")==3||node.getAttribute("cId")==4)
补充:asp教程,技巧与性能优化