Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Objects
Option Object
PROPERTY: Option::defaultSelected
object.
defaultSelected
This property, by default tainted, is a Boolean value which initially reflects whether an option was declared with the HTML SELECTED attribute, reading
true
if it was and
false
if not. You can set the
defaultselected
property at any time, and this will override the initial setting, but it won't be reflected in the display of the
Select
object. If, however, you set the
defaultSelected
property of a
Select
object created with the MULTIPLE attribute, any initial defaults are unaffected.
For example, assuming a
Select
object called DogBreed with the first option initially selected by default, the following code would alter that default to the fourth option:
Code:
document.myForm.dogBreed.options[3].defaultSelected = true
You could then test to see that this has actually happened as follows:
Code:
if(document.myForm.dogType.options[3].defaultSelected == true)
document.write("It's true, I tell you.")
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information