<HTML><HEAD><TITLE>New Document </TITLE>
<script>
functionck()
{
alert(arrSel);
document.all(arrSel[1]).options[document.all(arrSel[1]).selectedIndex].text;
}
</script>
<BODY>
<formname=form1>
<select name=year></select>
<select name=month></select>
<select name=date></select>
<select name=hour> </select>
<input type=text name=result>
<script>
vararrSel=["year","month","date","hour"];
</script>
<xml id=xmldata>
<xmldata>
<yearvalue="2000">
<month value="1">
<date value="1">
<hour value="1"/>
<hour value="2"/>
</date>
<date value="2">
<hour value="1"/>
<hour value="2"/>
</date>
</month>
<month value="2">
<date value="1">
<hour value="1"/>
<hour value="2"/>
</date>
<date value="2">
<hour value="1"/>
<hour value="2"/>
</date>
</month>
</year>
<year value="2001">
<month value="1">
<date value="1">
<hourvalue="1"/>
<hourvalue="2"/>
</date>
<date value="2">
<hourvalue="1"/>
<hourvalue="2"/>
</date>
</month>
<month value="2">
<date value="1">
<hourvalue="1"/>
<hour value="2"/>
</date>
<date value="2">
<hourvalue="1"/>
<hourvalue="2"/>
</date>
</month>
</year>
<year value="2002">
<month value="1">
<date value="1">
<hour value="1"/>
<hour value="2"/>
</date>
<date value="2">
<hour value="1"/>
<hour value="2"/>
</date>
</month>
<month value="2">
<date value="1">
<hourvalue="1"/>
<hour value="2"/>
</date>
<date value="2">
<hourvalue="1"/>
<hourvalue="2"/>
</date>
</month>
</year>
<year value="2003">
<month value="1">
<date value="1">
<hour value="1"/>
<hour value="2"/>
</date>
<date value="2">
<hour value="1"/>
<hour value="2"/>
</date>
</month>
<month value="2">
<date value="1">
<hourvalue="1"/>
<hourvalue="2"/>
</date>
<date value="2">
<hourvalue="1"/>
<hourvalue="2"/>
</date>
</month>
</year>
</xmldata>
</xml>
<script>
functionlpxml(num)
{
vari,j,arrTemp=[];
for(i=0;i<num;i++) {arrTemp[i]=document.all(arrSel[i]).options[document.all(arrSel[i]).selectedIndex].text;
//alert(arrTemp[i]);
}
if(num==arrSel.length)
{
document.all("result").value=arrTemp;return;
}
with(document.all(arrSel[num]))
{ length=0
varobj=document.all.xmldata.XMLDocument.childNodes[0];
for(i=0;i<num;i++)
obj=obj.selectSingleNode(arrSel[i]+'[@value="'+arrTemp[i]+'"]');
for(i=0;i<obj.childNodes.length;i++)options[length++].text=obj.childNodes[i].getAttribute("value");
onchange=newFunction("lpxml("+(num+1)+")");
onchange();
}
}
lpxml(0);
</script>
<input type=buttononclick="ck()">
</form>
</BODY>
</HTML>
原文链接:https://www.f2er.com/xml/300321.html