JS添加国家下拉表单
Download Source Code from attachment, unzip and get the .js file
Put this code between your and section:
<script src="countries3.js" type="text/javascript"></script>
Put this code between your and section:
Select Country:
<select onchange="print_state('state',this.selectedIndex);" id="country" name = "country"></select>
City/District/State:
<select name ="state" id = "state"></select>
<script language="javascript">print_country("country");</script>
Please note that, we are using two select tags, which are actual drop-down boxes. Here I’ve chosen “country” and “state” as their ID attribute. You can choose any othe id attribute or name attribute as you like. But whatever you choose, you make to pass the correct IDs when calling the JavaScript Functions.
If you only want Country list to appear on the page, Simply use following bit of code in Body section:
Select Country:
<select id="country" name ="country"></select>
<script language="javascript">print_country("country")</script>
You’ve to pass the ID of select element in print_country function, which actually prints the names of the countries.
阅读其他美文