Option default Selected Example : Option Select ComboBox : Form Control : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP


JavaScript DHTML  »  Form Control   » [  Option Select ComboBox  ]   
 



Option default Selected Example

Please note that some example is only working under IE or Firefox.

    
<html>
<body>
<form id="myForm"><select name="select">
    <option value="1">Item 1</option>
    <option value="2">Item 2</option>
    <option id="o3" value="3">Default selected Option</option>
    
<script language="JavaScript">
    document.getElementById("o3").defaultSelected = true;
    var n = document.getElementById("o3").innerText;
    function function1() {
        alert('Default selected Option label:\n'+'"'+n+'"');
        document.getElementById("myForm").reset()
    
</script> 
    <option value="4">Item 4</option>
    <option value="5">Item 5</option>
</select>
</form>
<input type="button" value='Click here' onclick="function1();">
</body>
</html>

    
      
      
Related examples in the same category
1.  Set select to multiple selected
2.  Options in select
3.  Option label
4.  Option selected Index Example
5.  Option selected
6.  Is Select a select-multiple
7.  'index' Example
8.  'value' Example
9.  Add an option to select
10.  'text' Example
11.  Option selected index
12.  Auto Linked Option Listbox without button
13.  Change background
14.  Changing Select Element Content (two Combobox)
15.  Drop-down Redirect - No Submit button
16.  Drop-down Redirect - Submit
17.  Dropdown list (combobox) in a form
18.  dropdown list (combobox) in form 2
19.  Disable or enable an option
20.  Disable and enable a dropdown list (combobox)
21.  Return the name of the form that contains dropdown list (combobox)
22.  Number of options in the dropdown list(Combobox)
23.  Change the size of a dropdown list (ComboBox)
24.  Select multiple options in a dropdown list (option)
25.  Return the selected option as text in option
26.  Return the selected option as a number
27.  Change the option text
28.  Remove an option from a dropdown list (combobox)
29.  Methods and Properties of the Select Object
30.  Properties of the Option Object
31.   Using the Location object to change another frame's URL
32.  Using a Summary Form to Support Local Processing
33.  Navigating with a SELECT Object
34.  Using the selectedIndex Property
35.   Modifying OPTGROUP Element Labels
36.  Using the options[index].text Property
37.   Using the options[index].value Property
38.  Triggering a Color Change from a Pop-Up Menu
39.  Modifying SELECT Options
40.  Modifying SELECT Options (IE4+)
41.  Modifying SELECT Options (NN6+)
42.  Selecting an Option Using JavaScript
43.  Linked ComboBox (option) Country =- province
44.  ComboBox set value to TextField
45.  Menu(Option) Generator
46.  URL Option ComboBox
47.  Show Selected Option items
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.