There are two ways to move a drop-down box in a traditional HTML page:
1 directly hardcode the contents of the dropdown box into JavaScript in HTML, invoking JavaScript function loops to write to the Drop-down box. This method does not apply to situations where the content of the dropdown box changes frequently. Because the data source and JavaScript program are written dead on the same page.
List
Onchange= "Changelocation (Document.myform.biglocation.options[document.myform.biglocation.selectedindex].value) "> Jiangxi
== All areas ==
2 JavaScript reads the database directly, takes the records in the database to the JavaScript, and then, like the first method, invokes the JavaScript function loop to write to the Drop-down box. This method separates the data source from JavaScript, but exposes the connection to the database and, from a security standpoint, has little practical value.
My approach is to put the data in the Drop-down box in an XML file, read the XML file with JavaScript, and get the contents of the Drop-down box.
The HTML file is as follows:
call XML data in HTML
Type
Sub-class
Account.xml is as follows:
not available
dangdang1
dangdang2
dangdang3
dangdang4
dangdang5
dangdang6
zhuce_user1
zhuce_user2
tongxun
This method separates the data source from the JavaScript program and is suitable for frequently changing data sources. Xmldoc.load can call URL parameters directly, read remote XML, and achieve loose coupling. The above application is passed in the IE6.0. The disadvantage is that you need to remove the dropdown box list content
Repeat the delete operation, otherwise there will be a noticeable bug. I hope that some readers can correct me.