Linked ComboBox (option) Country =- province : Option Select ComboBox « Form Control « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Dojo toolkit
7. Event
8. Event onMethod
9. Ext JS
10. Form Control
11. GUI Components
12. HTML
13. Javascript Collections
14. Javascript Objects
15. Javascript Properties
16. jQuery
17. Language Basics
18. Mochkit
19. Mootools
20. Node Operation
21. Object Oriented
22. Page Components
23. Rico
24. Scriptaculous
25. Security
26. SmartClient
27. Style Layout
28. Table
29. Utilities
30. Window Browser
31. YUI Library
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
JavaScript DHTML » Form Control » Option Select ComboBox 
Linked ComboBox (option) Country =- province
   

<html>
<head>
<title>Create Form Elements</title>

<script language="javascript">
<!--

function CreateProvince() {

  var Primary = document.newforms.country.selectedIndex;

  if ((Primary == null|| (Primary == 0)) return;

  if (Primary == 1) {

  var ProvState = new Array;
  ProvState[0new Option("Alberta");
  ProvState[1new Option("British Columbia");
  ProvState[2new Option("Manitoba");
  ProvState[3new Option("New Brunswick");
  ProvState[4new Option("Newfoundland");
  ProvState[5new Option("Nova Scotia");
  ProvState[6new Option("Northwest Territories");
  ProvState[7new Option("Nunavut");
  ProvState[8new Option("Ontario");
  ProvState[9new Option("Prince Edward Island");
  ProvState[10new Option("Quebec");
  ProvState[11new Option("Saskatchewan");
  ProvState[12new Option("Yukon");

  }

  if (Primary == 2) {

  var ProvState = new Array;
  ProvState[0new Option("Alabama");
  ProvState[1new Option("Alaska");
  ProvState[2new Option("Arizona");
  ProvState[3new Option("Arkansas");
  ProvState[4new Option("California");
  ProvState[5new Option("Colorado");
  ProvState[6new Option("Connecticut");
  ProvState[7new Option("Delaware");
  ProvState[8new Option("Florida");
  ProvState[9new Option("Georgia");
  ProvState[10new Option("Hawaii");
  ProvState[11new Option("IdahoState");
  ProvState[12new Option("Illinois");
  ProvState[13new Option("Indiana");
  ProvState[14new Option("Iowa");
  ProvState[15new Option("Kansas");
  ProvState[16new Option("Kentucky");
  ProvState[17new Option("Louisiana");
  ProvState[18new Option("Maine");
  ProvState[19new Option("Maryland");
  ProvState[20new Option("Massachusetts");
  ProvState[21new Option("Michigan");
  ProvState[22new Option("Minnesota");
  ProvState[23new Option("Mississippi");
  ProvState[24new Option("Missouri");
  ProvState[25new Option("Montana");
  ProvState[26new Option("Nebraska");
  ProvState[27new Option("Nevada");
  ProvState[28new Option("NewHampshire");
  ProvState[29new Option("NewJersey");
  ProvState[30new Option("NewMexico");
  ProvState[31new Option("NewYork");
  ProvState[32new Option("NorthCarolina");
  ProvState[33new Option("NorthDakota");
  ProvState[34new Option("Ohio");
  ProvState[35new Option("Oklahoma");
  ProvState[36new Option("Oregon");
  ProvState[37new Option("Pennsylvania");
  ProvState[38new Option("RhodeIsland");
  ProvState[39new Option("SouthCarolina");
  ProvState[40new Option("SouthDakota");
  ProvState[41new Option("Tennessee");
  ProvState[42new Option("Texas");
  ProvState[43new Option("Utah");
  ProvState[44new Option("Vermont");
  ProvState[45new Option("Virginia");
  ProvState[46new Option("Washington");
  ProvState[47new Option("WestVirginia");
  ProvState[48new Option("Wisconsin");
  ProvState[49new Option("Wyoming");

  }

  for (i=document.newforms.SelectProvState.options.length; i>0; i--) { 
  document.newforms.SelectProvState.options[inull;
  }

  for(i=0; i<ProvState.length; i++) {
  document.newforms.SelectProvState.options[i= ProvState[i];
  }

  document.newforms.SelectProvState.options[0].selected = true;

}

//-->
</script>


</head>

<body>

<form name="newforms">

Choose Country:

<select name="country" onChange="CreateProvince()">

  <option value="">Choose Country</a>
  <option value="Canada">Canada</a>
  <option value="USA">USA</a>

</select>

<select name="SelectProvState">

  <option value="1">Choose province/state</option>

</select>

</form>
</body>
</html>




           
         
    
    
  
Related examples in the same category
1. Set select to multiple selected
2. Options in select
3. Option label
4. Option default Selected Example
5. Option selected Index Example
6. Option selected
7. Is Select a select-multiple
8. 'index' Example
9. 'value' Example
10. Add an option to select
11. 'text' Example
12. Option selected index
13. Auto Linked Option Listbox without button
14. Triggering a Value Change from a Pop-Up Menu
15. Cycling through a Multiple-Selection List
16. Modifying optgroup Element Labels
17. Grouped selection control on change event
18. Change background
19. Changing Select Element Content (two Combobox)
20. Drop-down Redirect - No Submit button
21. Drop-down Redirect - Submit
22. Dropdown list (combobox) in a form
23. dropdown list (combobox) in form 2
24. Disable or enable an option
25. Disable and enable a dropdown list (combobox)
26. Return the name of the form that contains dropdown list (combobox)
27. Number of options in the dropdown list(Combobox)
28. Change the size of a dropdown list (ComboBox)
29. Select multiple options in a dropdown list (option)
30. Return the selected option as text in option
31. Return the selected option as a number
32. Change the option text
33. Remove an option from a dropdown list (combobox)
34. Methods and Properties of the Select Object
35. Properties of the Option Object
36.  Using the Location object to change another frame's URL
37. Using a Summary Form to Support Local Processing
38. Navigating with a SELECT Object
39. Using the selectedIndex Property
40.  Modifying OPTGROUP Element Labels
41. Using the options[index].text Property
42.  Using the options[index].value Property
43. Triggering a Color Change from a Pop-Up Menu
44. Modifying SELECT Options
45. Modifying SELECT Options (IE4+)
46. Modifying SELECT Options (NN6+)
47. Selecting an Option Using JavaScript
48. ComboBox set value to TextField
49. Menu(Option) Generator
50. URL Option ComboBox
51. Show Selected Option items
52. Click button to navigate to selected url from form select control
53. Set the select control value
54. Add or remove options from select form control
55. Get changed selection from form select
56. Demonstrates select object used as a multi-line list box
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.