JavaScript call XML production link pull box
Author: He Yao
Thursday, June 5 2003 2:44 PM
Two methods are used in the traditional HTML page:
1) Directly use the contents of the drop-down box in the HTML's JavaScript to call the JavaScript function loop write to the drop-down box. This method is not suitable for the case where the pull-down box content is often changed. Because the data source and the JavaScript program are written on the same page.
VAR OneCount;
OneCount = 0;
Subcat = new array ();
Subcat [0] = New Array ("Xuhui District", "01", "001");
Subcat [1] = New Array ("Jiading District", "01", "002");
Subcat [2] = New Array ("Huangpu District", "01", "003");
Subcat [3] = New Array ("Nanchang", "02", "004");
Subcat [4] = New Array ("Jiujiang", "02", "005");
Subcat [5] = New Array ("Shangrao City", "02", "006");
OneCount = 6;
Function ChangeLocation (locationID)
{
Document.myform.smallLocation.Length = 0;
Var locationId = locationID;
Var i;
Document.myform.smallLocation.Options [0] = new option ('==== all regions ====', '');
For (i = 0; i { IF (Subcat [I] [1] == locationID) { Document.myform.smallLocation.Options [Document.myform.smallLocation.Length] = New option (SUBCAT [I] [0], SUBCAT [I] [2]); } } } // -> script> hEAD>