PROPERTY:  Option::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:
document.myForm.dogBreed.options[3].defaultSelected = true
You could then test to see that this has actually happened as follows:
if(document.myForm.dogType.options[3].defaultSelected == true)
   document.write("It's true, I tell you.")

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information