Matt wrote:
The following code won't work, because onchange event is not trigger
when drop down size = 1. But if I make the size="2" or greater, then
it will work. Is that true? please advise. thanks!!
<script type="text/javascript">
function showRange()
{ alert("showRange");
}
</script>
<SELECT NAME="range" SIZE="1" onchange="showRange();">
<OPTION VALUE="0">address 1</OPTION>
</SELECT>
It works fine if you have more than one <option>. If you only have a
single option, there is nothing to "change", so no "onchange" event can
be triggered. The reason it works if have a single <option> and you
specify size="2" is because you now have your defined <option> and an
empty, undefined space for an option. The user can now click that blank
entry, cause a "change" in the item selected which fires the onchange
event.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq