VK wrote:
de*********@rediffmail.com wrote:
Hi,
I need an urgent help from you.
When we dynamically genrate any list box (Select Box) it shows one
default value as selected.
Is there any way that we can deselect that value.
I tried with document.form_Name.ListBox_Name.options[0].selected =
false;
I don't want any value to be selected in the list Box.
Give the first option no value and no text and set it as the default
selected.
[...]
For single choice w/o default value you have to use a set of radio
buttons:
It is not certain that one of a set of radio buttons will not be
selected by default by the browser:
"If no radio button in a set sharing the same control name is
initially 'on', user agent behavior for choosing which control is
initially 'on' is undefined. Note. Since existing implementations
handle this case differently, the current specification differs
from RFC 1866 ( [RFC1866] section 8.1.2.4), which states:
At all times, exactly one of the radio buttons in a set is
checked. If none of the <INPUT> elements of a set of radio
buttons specifies `CHECKED', then the user agent must check the
first radio button of the set initially.
"Since user agent behavior differs, authors should ensure that in
each set of radio buttons that one is initially 'on'."
<URL:http://www.w3.org/TR/html4/interact/forms.html#radio>
Also, once one is selected it is impossible to get back to none
selected without using either a reset, page re-load or script.
[...]
--
Rob