Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16155
| From | Gregor Kofler <usenet@gregorkofler.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: silly question on Date value evaluation or comparison |
| Date | 2012-09-26 09:11 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <k3u9q7$m69$1@dont-email.me> (permalink) |
| References | <f3ac39d0-7800-442d-ac95-f000b89e32b0@a11g2000yqb.googlegroups.com> |
Am 2012-09-26 02:21, schrieb justaguy:> Hi,
>
> HTML code:
> <input type="text" id="dateField">
>
> js code:
> var dateValue = new
> Date(document.getElementById('dateField').value);
> switch (dateValue) {
> case '9/25/2012':
> alert ('case 1 here');
> {
> dosomething here..
> }
>
> default:
> alert("I'm not doing it right");
> }
>
> Comment:
> I've entered the value of "9/25/2012" (of course without quotes) for
> the dateField entry, but the case switch returns to default, so, I
> guess 9/25/2012 is not the value for a date, then what?
Why not RTFM? The date object generation is your first problem, your
next one will be the comparison in the case statement.
And RTFM would most likely solve a bunch of your future "problems", too.
Gregor
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
silly question on Date value evaluation or comparison justaguy <lichunshen84@gmail.com> - 2012-09-25 17:21 -0700
Re: silly question on Date value evaluation or comparison Christoph Becker <cmbecker69@gmx.de> - 2012-09-26 02:36 +0200
Re: silly question on Date value evaluation or comparison justaguy <lichunshen84@gmail.com> - 2012-09-25 18:39 -0700
Re: silly question on Date value evaluation or comparison "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-09-26 07:57 +0300
Re: silly question on Date value evaluation or comparison Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-27 21:27 +0100
Re: silly question on Date value evaluation or comparison RobG <rgqld@iinet.net.au> - 2012-10-03 00:12 -0700
Re: silly question on Date value evaluation or comparison Dr J R Stockton <reply1240@merlyn.demon.co.uk.invalid> - 2012-10-04 19:36 +0100
Re: silly question on Date value evaluation or comparison Scott Sauyet <scott.sauyet@gmail.com> - 2012-10-05 13:21 -0700
Re: silly question on Date value evaluation or comparison Dr J R Stockton <reply1240@merlyn.demon.co.uk.invalid> - 2012-10-06 19:06 +0100
Re: silly question on Date value evaluation or comparison "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-10-07 08:03 +0000
Re: silly question on Date value evaluation or comparison Patricia Shanahan <pats@acm.org> - 2012-10-07 09:48 +0100
Re: silly question on Date value evaluation or comparison "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-10-07 10:09 +0000
Re: silly question on Date value evaluation or comparison Gregor Kofler <usenet@gregorkofler.com> - 2012-09-26 09:11 +0200
csiph-web