All address data is placed in the js file. The method of calling the control is very simple:
The AreaCtrl class has up to 3 parameters, such as "province" in the above example," City", "Region", the text here is the text on the left side of the drop-down box. If you only write 1 or 2 parameters, then the control will only output the province or province-city linkage. For example, new AreaCtrl("Province", "City"), then there are only 2 drop-down boxes, and the address is accurate to the city.
area has 2 attributes and 2 methods.
Properties:
name
Define the control name. The value must be an array type, such as ["Province", "City", "Area"]. The name attributes of the three drop-down boxes will be defined, namely Province, City, and Area.
value
Initializes the default value of the control. The value must be an area code number. For example, the code for Guangdong is 440000 and the code for Shenzhen is 440300.
Method:
write
areaObject.write()
Output control. The position of the output depends on the position of this statement.
writeIn
areaObject.writeIn( node [ ,append ] )
Output control. The output location depends on the specified node. The node can be an ID number or a structure node.
append is a Boolean value, the default is false. When true, the control will continue writing at the specified location.
area.js<script> <BR> var area = new AreaCtrl("省份:","城市:","地区:"); <BR> area.write(); <BR></script>