Re: Checking Select Option Value Without Form Submital
- From: Dr John Stockton <jrs@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 6 Feb 2006 15:32:52 +0000
JRS: In article <1139175661.044046.120550@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
, dated Sun, 5 Feb 2006 13:41:01 remote, seen in
news:comp.lang.javascript, VK <schools_ring@xxxxxxxxx> posted :
75battle@xxxxxxxxx wrote:
I am allowing a user to selected a date to schedule an event and it
seems like the best way to do this is with drop down menus for Year,
month, date. However I would like to make it so when you choose a year
and a month the appropriate days for that month show (i.e. 28 days if
you chose February 2006). I can easily do this with a loop if I can
find out what month the user has selected, but I can't seem to find a
way to get that value. Is there a simple javascript solution to this
problem?
<select name="myMonthList"
onchange="setBestDay(this.form, this.selectedIndex)">
<option value="0">January</option>
...
</select>
where in the <head> section you have:
<script type="text/javascript">
function setBestDay(f,m) {
// m corresponds to the selected month
// 0 - January, 11 - December
// do your calculations
// then:
f.myDayList.selectedIndex = myCalculatedIndex;
}
</script>
There is much to be said for understanding a question before attempting
to give an answer - you should try it sometime.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
.
- References:
- Prev by Date: Re: Typical size of Javascript interpreter
- Next by Date: Re: String replace and regexp
- Previous by thread: Re: Checking Select Option Value Without Form Submital
- Next by thread: Re: Checking Select Option Value Without Form Submital
- Index(es):
Relevant Pages
|