Select option list - Malaysia
Download the code, which will list the names of Malaysian States (negeri) or divisions select drop down list.
Two methods of coding are displayed. One using javascript array and the other using simple plain html option list.
Features
- HTML option list to show the divisions (states / provinces / counties / municipalities /
parishes / districts / regions) of the country Malaysia .
- Javascript method which reduces the lines of code and uses array.
- Easy to edit and add the list.
Preview
Code
Method I: Using Javascript Array
<!-- Script by hscripts.com -->
<select name=slist>
<script language="javascript">
var states = new Array("Johor", "Kedah", "Kelantan", "Kuala Lumpur", "Labuan", "Malacca", "Negeri Sembilan", "Pahang", "Perak", "Perlis", "Penang", "Sabah", "Sarawak", "Selangor", "Terengganu");
for(var hi=0; hi<states.length; hi++)
document.write("<option value=\""+states[hi]+"\">"+states[hi]+"</option>");
</script>
</select>
<!-- Script by hscripts.com -->
Method II: HTML Option List
<!-- Script by hscripts.com -->
<select name=slist>
<option value="Johor">Johor</option>
<option value="Kedah">Kedah</option>
<option value="Kelantan">Kelantan</option>
<option value="Kuala Lumpur">Kuala Lumpur</option>
<option value="Labuan">Labuan</option>
<option value="Malacca">Malacca</option>
<option value="Negeri Sembilan">Negeri Sembilan</option>
<option value="Pahang">Pahang</option>
<option value="Perak">Perak</option>
<option value="Perlis">Perlis</option>
<option value="Penang">Penang</option>
<option value="Sabah">Sabah</option>
<option value="Sarawak">Sarawak</option>
<option value="Selangor">Selangor</option>
<option value="Terengganu">Terengganu</option>
</select>
<!-- Script by hscripts.com -->
Usage
- Just copy the code into your pages to list the Malaysia States (negeri) as javascript drop down list.
- The countries are usually divided as states or provinces or counties or municipalities or parishes or districts or regions.
Related Scripts