<%
'設置輸出的字元編碼
Response.charset = "gb2312"
'獲取省份
id = request.QueryString("id")
if id = "layer0" then
province = "湖南"
elseif id = "layer1" then
province = "廣東"
elseif id = "layer2" then
province = "廣西"
end if
'載入XML解析器
Set objXML = Server.CreateObject("Msxml2.DOMDocument")
'載入XML文件
xmlDoc = objXML.load(Server.MapPath("sample15.xml"))
'獲得省份節點
Set provinceNode = objXML.getElementsByTagName(province)
'獲得省份節點下的所有市節點
set cityNodes = provinceNode(0).getElementsByTagName("市")
'設置輸出的文字
returnStr = ""
For i = 0 To cityNodes.length-1
returnStr = returnStr & cityNodes(i).text & ","
Next
'輸出文字
Response.Write returnStr
set cityNodes = Nothing
set provinceNode = Nothing
set xmlDoc = Nothing
set objXML = Nothing
%>