Re: Checking Select Option Value Without Form Submital



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.
.



Relevant Pages

  • Re: hta file looks for internet access on onload
    ... JRS: In article, dated Mon, 21 ... Jeff Cochran posted: ... >to set them to bypass the proxy for the domain in question. ... Don't Mail News. ...
    (microsoft.public.scripting.vbscript)
  • Re: using setTimeout when using prototype
    ... JRS: In article, dated Wed, 1 Feb ... 'PointedEars' Lahn posted: ... Don't Mail News. ...
    (comp.lang.javascript)
  • Re: AJAX.NET and prototype.js
    ... JRS: In article, dated Thu, 20 ... Cornford posted: ... ISTM unwise to write only that, since if heeded it may lead to posting ... Don't Mail News. ...
    (comp.lang.javascript)
  • Re: Eclipse image
    ... JRS: In article, dated Fri, 7 Apr 2006 ... Web -> Timo Salmi: Usenet Q&A. ... Web: about usage of News. ... Don't Mail News. ...
    (uk.sci.astronomy)
  • Re: overwrite some files
    ... JRS: In article, dated Mon, 4 ... Thorsten Helfer posted: ... Quotes before replies. ... Don't Mail News. ...
    (microsoft.public.scripting.vbscript)