type property (keygen, select)
Returns a string that identifies whether more than one item can be selected in a selection list.
The selection type can be modified by the multiple property.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
String that represents the type of the selection list.
One of the following values:
Multiple selection is disabled. The multiple property is set to false. | |||||||
Multiple selection is enabled. The multiple property is set to true. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the type property:
|
||||
<head> <script type="text/javascript"> function GetSelType () { var selectObj = document.getElementById ("mySelect"); alert (selectObj.type); } function ToggleSelType () { var selectObj = document.getElementById ("mySelect"); selectObj.multiple = !selectObj.multiple; } </script> </head> <body> <select multiple="multiple" id="mySelect"> <option>Apple</option> <option selected="selected">Peach</option> <option>Pear</option> </select> <br /> <button onclick="GetSelType ();">Get the selection type!</button> <br /> <button onclick="ToggleSelType ();">Toggle the selection type!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments