Print? // Convert the string to xmlfunctiontoXmlDom (source) {varxmlDocnull; if (window. ActiveXObject) {varARR_ACTIVEX [& quot; MSXML4.DOMDocument & quot;, & quot; MSXML3.DOMDocument & quot;, & q
Print? // Convert string to xml
Function toXmlDom (source ){
Var xmlDoc = null;
If (window. ActiveXObject ){
Var ARR_ACTIVEX =
["MSXML4.DOMDocument", "MSXML3.DOMDocument", "MSXML2.DOMDocument", "MSXML. DOMDocument", "Microsoft. XmlDom"];
Var XmlDomflag = false;
For (var I = 0; I <ARR_ACTIVEX.length &&! XmlDomflag; I ++ ){
Try {
Var objXML = new ActiveXObject (ARR_ACTIVEX [I]);
XmlDoc = objXML;
XmlDomflag = true;
} Catch (e ){
}
}
If (xmlDoc ){
XmlDoc. async = false;
XmlDoc. loadXML (source );
}
} Else {
Var parser = new DOMParser ();
Var xmlDoc = parser. parseFromString (source, "text/xml ");
}
Return xmlDoc;
}
// Convert string to xml
Function toXmlDom (source ){
Var xmlDoc = null;
If (window. ActiveXObject ){
Var ARR_ACTIVEX =
["MSXML4.DOMDocument", "MSXML3.DOMDocument", "MSXML2.DOMDocument", "MSXML. DOMDocument", "Microsoft. XmlDom"];
Var XmlDomflag = false;
For (var I = 0; I <ARR_ACTIVEX.length &&! XmlDomflag; I ++ ){
Try {
Var objXML = new ActiveXObject (ARR_ACTIVEX [I]);
XmlDoc = objXML;
XmlDomflag = true;
} Catch (e ){
}
}
If (xmlDoc ){
XmlDoc. async = false;
XmlDoc. loadXML (source );
}
} Else {
Var parser = new DOMParser ();
Var xmlDoc = parser. parseFromString (source, "text/xml ");
}
Return xmlDoc;
}
[Javascript]
// Use
Function areaChart (data ){
Var s = toXmlDom (xml); // xml is a string
$ (S). find ("area"). each (// obtain the label of each area
Function (id, item ){
Var areaCode = $ (item). find ("area_code"). eq (0). text (); // obtain the area TAG content
Var num = $ (item). find ("area_all_num"). eq (0). text ();
Var name = $ (item). find ("area_name"). eq (0). text ();
Var title = name + "," + num;
$ ("#" + AreaCode + ""). attr ("title", title );
}
);
// Use
Function areaChart (data ){
Var s = toXmlDom (xml); // xml is a string
$ (S). find ("area"). each (// obtain the label of each area
Function (id, item ){
Var areaCode = $ (item). find ("area_code"). eq (0). text (); // obtain the area TAG content
Var num = $ (item). find ("area_all_num"). eq (0). text ();
Var name = $ (item). find ("area_name"). eq (0). text ();
Var title = name + "," + num;
$ ("#" + AreaCode + ""). attr ("title", title );
}
);