Select XML version of level two linkage
Last Update:2017-02-28
Source: Internet
Author: User
Select|xml XML file
JS file
var marketxmldoc = new ActiveXObject ("Msxml2.domdocument");
Marketxmldoc.async = false;
Marketxmldoc.load ("/xml/market_list.") XML ");
function Getmarketlist (Type)
{
var Nodes;
Switch (Type)
{
Case "Allcitys":
Nodes=marketxmldoc.getelementsbytagname ("City");
Break
Case "Allmarkets":
Nodes=marketxmldoc.getelementsbytagname ("Market");
Break
Case "Themarkets":
CITYID=ARGUMENTS[ARGUMENTS.LENGTH-1];
if (cityid!= "")
{
Nodes=marketxmldoc.selectnodes (".//city[@RecordNo = '" + Cityid + "']//market");
}
Else
{
Nodes=marketxmldoc.selectnodes (".//city//market");
}
Break
Default:
Break
}
return Nodes;
}
function Changemarkets ()
{
Cityid=event.srcelement.options[event.srcelement.selectedindex].value;
Generatemarketlist ("Themarkets", "Market", "" "," ", Cityid)
}
function Changemarketsex ()
{
Cityid=event.srcelement.options[event.srcelement.selectedindex].value;
Generatemarketlistex ("Themarkets", "_market", "" "," ", Cityid)
}
function Generatemarketlist (type,name,style,class)
{
var Olist,oitem;
var cityid=arguments[arguments.length-1];
var nodes=getmarketlist (Type,cityid);
if (nodes.length==0) return;
Switch (Type)
{
Case "Allcitys":
Case "Allmarkets":
Olist=document.createelement ("select");
Olist.style.csstext=style;
Olist.classname=class;
Olist.name=name;
Olist.id=name;
Olist.onchange= (type== "Allcitys"?) Changemarkets () ":" ");
Break
Case "Themarkets":
Olist=document.getelementsbyname (Name) [0];
Olist.innerhtml= "";
Break
Default:
Break
}
Oitem=document.createelement ("option");
Oitem.value= "";
oitem.innertext= "-Search All-";
Olist.appendchild (Oitem);
for (I=0;i {
Oitem=document.createelement ("option");
Oitem.value=nodes[i].getattribute ("Recordno");
Oitem.innertext=nodes[i].getattribute ("Name");
Olist.appendchild (Oitem);
}
return olist;
}
function inputaddress ()
{
Newvalue=event.srcelement.options[event.srcelement.selectedindex].text
document.getElementById ("Address1"). Value+=newvalue;
}
function Generatemarketlistex (type,name,style,class,callback)
{
var Olist,oitem;
var cityid=arguments[arguments.length-1];
var nodes=getmarketlist (Type,cityid);
if (nodes.length==0) return;
Switch (Type)
{
Case "Allcitys":
Case "Allmarkets":
Olist=document.createelement ("select");
Olist.style.csstext=style;
Olist.classname=class;
Olist.name=name;
Olist.id=name;
Olist.onchange= (type== "Allcitys"?) Changemarketsex (); ":" ") +callback);
Break
Case "Themarkets":
Olist=document.getelementsbyname (Na