XML volume actual combat kit (4): menu

xiaoxiao2021-03-06  39

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]

Jiujiang Nanchang Lushan Jingdezhen Beijing West Juyongguan Tsinghua Park Zhoukou shop Lanzhou Luo Gumens Jiayuguan Guangzhou Shenzhen Dongguan Shipai Hefei Huangshan Jiulonggang Maanshan

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]

post: When I started learning XML, I also confused with everyone - - "XML I am learning, can this XML should be used?" This problem blocks me for a long time, for a long time ... Because e-commerce and software development is my expertise, so I think it is from The most familiar start start. So I complete some of the most commonly used functions in the website in XML. You can also!

转载请注明原文地址:https://www.9cbs.com/read-70165.html

New Post(0)