Motivation: Now we have a small example of applying XML in IE: Solve the link between dual pull ordering. Everyone is the most common possibility is to select the example of changing the city option after the province. Let's try to complete it with XML. Some of the features mentioned in the previous introduction I have done directly with the XML XSL file. You may not be very familiar with it, so I use HMTL XML this time, I hope everyone knows more clearly - " XML is so simple! ":) Material: XML volume menu is combined with 2 files: citys.xml and cityselect.htm effect: After selecting the province, you can automatically display the corresponding city, which makes it easy for users to improve data. Interact, make your own page more colorful. Effect: Browse here citys.xml
Program code: [Copy code to clipboard]
XML Version = "1.0" encoding = "GB2312"?>
CitySelect.htm Custom Function: ChooseState (Name of the province in XML data) and add to the selstate drop-down list)
Program code: [Copy code to clipboard]
Function choiseState () {var source; var source = "city s.xml"; var source = new activiXObject ('microsoft.xmldom'); // Create a MSXML parser instance source.Assync = false; source.load (SourceName) ; // Load the XML document root = source.documentelement; // Set the document element to the root node element sortfield = root.selectnodes ("@ Name"); // All node containing Name in the search property (VAR i = 0; i Program code: [Copy code to clipboard] Function choiseCity () {x = form1.selstate.selectedIndIndex; // read the current option of the province drop-down box y = form1.Selstate.Options [x] .value; sortfield = root.selectnodes ("// state [@ name = '" y "'] / city & q UOT; / / Search all the CITY node for the Name property equals the State node below the parameter y (var i = form1.selcity.Options.Length-1; I> = 0; --I) // Undo the original list {form1.selcity.Options.remove (i)} for (var i = 0; i Form source code Program code: [Copy code to clipboard]