473,789 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need a little help :)

I have a drop down list system (works to some extent) for a date range search
that I need to do a little more. The following is a small sample from the
script:

function modify_mo_list( mo_model)
{
molist = document.forms[0].querymo2;
if (mo_model == '/01/') {
var i = 0;
molist.options[i++] = new Option('Februar y','/02/');
molist.options[i++] = new Option('March', '/03/');
molist.options[i++] = new Option('April', '/04/');
molist.options[i++] = new Option('May','/05/');
molist.options[i++] = new Option('June','/06/');
molist.options[i++] = new Option('July','/07/');
molist.options[i++] = new Option('August' ,'/08/');
molist.options[i++] = new Option('Septemb er','/09/');
molist.options[i++] = new Option('October ','/10/');
molist.options[i++] = new Option('Novembe r','/11/');
molist.options[i++] = new Option('Decembe r','/12/');
molist.options[i++] = new Option('January ','/01/');
molist.options. length = i;
}
}

The entire list is comprised of Months Jan-Dec and years 1990-2006. I have it
automatically selecting the next month, when the user selects June in the first
box it automatically changes the second box to July. The year also when changed
updates the next year box. But what I also need is for the year to advance 1
year if December is selected, so that the search is from December 2000 to
January 2001. Right now it will display December 2000 to January 2000. However
when the actual searching takes place in my cgi it searches based on the input,
having those dates as input it will actually search and print everything it
finds except what is between those dates as it is looking for greater than
December 2000 and less than January 2000.

So basically I need it to change the date as it does for all months other than
December, where it is to change the year to the next year.

I have tried so many things to no avail. If someone has a suggestion let me
know.

You can view a working sample here:
<a href="http://www.inspiration aldistributors. com/search4date.htm l">
http://www.inspirationaldistributors...arch4date.html
</a> You should also be able to see the source code for how it works there also
so you can see all the code involved.

Thanks for any help

Jeff C
Jul 20 '05 #1
7 1665
Ivo

"Keyed4U" <ke*****@aol.co m> wrote in message
news:20******** *************** ****@mb-m15.aol.com...
I have a drop down list system (works to some extent) for a date range search
I have it automatically selecting the next month, when the user selects June in the first box it automatically changes the second box to July. The year also when changed updates the next year box. But what I also need is for the year to advance 1 year if December is selected, so that the search is from December 2000 to
January 2001. Right now it will display December 2000 to January 2000.
You can view a working sample here:
http://www.inspirationaldistributors...arch4date.html
Thanks for any help
Jeff C


I was just working on some PHP script which does the same also for days,
given an array $getDaysInMonth (31,28/29,31,30,31,etc .). See if you can
convert it to javascript:

function adjustDate($day ,$month, $year) {
$a = array($day,$mon th,$year);
while ($a[0] > getDaysInMonth( $a[1], $a[2])) {$a[0] -=
getDaysInMonth( $a[1], $a[2]); $a[1]++;while ($a[1] > 12) { $a[1] -= 12;
$a[2]++;}}
while ($a[0] <= 0) { $a[0] += getDaysInMonth( $month, $year); $a[1]--; while
($a[1] <= 0) { $a[1] += 12; $a[2]--; }}
while ($a[1] > 12) { $a[1] -= 12; $a[2]++; }
while ($a[1] <= 0) { $a[1] += 12; $a[2]--; }
return $a;
}
Jul 20 '05 #2
Ivo

"Ivo" <no@thank.you > wrote in message
news:3f******** *************@n ews.wanadoo.nl. ..

"Keyed4U" <ke*****@aol.co m> wrote in message
news:20******** *************** ****@mb-m15.aol.com...
I have a drop down list system (works to some extent) for a date range search
I have it
automatically selecting the next month, when the user selects June in the first
box it automatically changes the second box to July. The year also when changed
updates the next year box. But what I also need is for the year to

advance 1
year if December is selected, so that the search is from December 2000

to January 2001. Right now it will display December 2000 to January 2000.
You can view a working sample here:
http://www.inspirationaldistributors...arch4date.html
Thanks for any help
Jeff C


I was just working on some PHP script which does the same also for days,
given an array $getDaysInMonth (31,28/29,31,30,31,etc .). See if you can
convert it to javascript:

function adjustDate($day ,$month, $year) {
$a = array($day,$mon th,$year);
while ($a[0] > getDaysInMonth( $a[1], $a[2])) {
$a[0] -= getDaysInMonth( $a[1], $a[2]);
$a[1]++;while ($a[1] > 12) { $a[1] -= 12; $a[2]++;}
}
while ($a[0] <= 0) {
$a[0] += getDaysInMonth( $month, $year);
$a[1]--; while ($a[1] <= 0) { $a[1] += 12; $a[2]--; }
}
while ($a[1] > 12) { $a[1] -= 12; $a[2]++; }
while ($a[1] <= 0) { $a[1] += 12; $a[2]--; }
return $a;
}


Went too fast. getDaysInMonth is a function that considers the year in its
second argument, so that we can determine February.
HTH
I
Jul 20 '05 #3
Lee
Keyed4U said:

I have a drop down list system (works to some extent) for a date range search
that I need to do a little more. The following is a small sample from the
script:


Let the built-in Date() object do the calculations for you:
<html>
<head>
<script type="text/javascript">
function update(f){
if(f.m0.selecte dIndex && f.y0.selectedIn dex){
m0=f.m0.selecte dIndex;
y0=1989+f.y0.se lectedIndex;
date1=new Date(y0,m0,1);
f.m1.selectedIn dex=date1.getMo nth()+1;
f.y1.selectedIn dex=date1.getFu llYear()-1989;
}
}
</script>
</head>
<body>
<form>
<select name="m0" onchange="updat e(this.form)">
<option>Choos e Month</option>
<option>January </option>
<option>Februar y</option>
<option>March </option>
<option>April </option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>Augus t</option>
<option>Septemb er</option>
<option>October </option>
<option>Novembe r</option>
<option>Decembe r</option>
</select>
<select name="y0" onchange="updat e(this.form)">
<option>Choos e Year</option>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
<option>1995</option>
<option>1996</option>
<option>1997</option>
<option>1998</option>
<option>1999</option>
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
</select>
<br>
<select name="m1">
<option>Choos e Month</option>
<option>January </option>
<option>Februar y</option>
<option>March </option>
<option>April </option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>Augus t</option>
<option>Septemb er</option>
<option>October </option>
<option>Novembe r</option>
<option>Decembe r</option>
</select>
<select name="y1">
<option>Choos e Year</option>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
<option>1995</option>
<option>1996</option>
<option>1997</option>
<option>1998</option>
<option>1999</option>
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
<option>2005</option>
<option>2006</option>
<option>2007</option>
</select>
</form>
</body>
</html>

Jul 20 '05 #4
Thanks for the help, it seems that the built-in date function does in deed work
perfect. Again it was much appreciated. I usually stick to cgi, but for this
small project I wanted to reduce the number of scripts in the cgi directory for
me to have to keep track of!!

Jeff C
Jul 20 '05 #5
JRS: In article <20************ *************** @mb-m15.aol.com>, seen in
news:comp.lang. javascript, Keyed4U <ke*****@aol.co m> posted at Sat, 27
Sep 2003 02:34:34 :-

Please use an informative Subject line.
So basically I need it to change the date as it does for all months other than
December, where it is to change the year to the next year.
with (DateObj) setMonth(getMon th()+1) // can use UTC.
I have tried so many things to no avail. If someone has a suggestion let me
know.
The FAQ? see below.
You can view a working sample here:


Not helpful to those who read News off-line. A clear and unambiguous
description of the need is better.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #6
Thanks to those who were actually helpful, and not to those that just can't
help or explain, but rather complain about how a post is written. If you can't
help out on the newsgroup posts, just don't bother commenting.

Again thanks to the folks who DID give sample code and helpful information.
Jul 20 '05 #7
ke*****@aol.com (Keyed4U) writes:
Thanks to those who were actually helpful, and not to those that
just can't help or explain, but rather complain about how a post is
written. If you can't help out on the newsgroup posts, just don't
bother commenting.


Sorry, but that attitude will not help get you answers from people who
can help you.

The suggestions on how to post are, to quote Matrix, for your
protection. Following them will make it more likely that you get the
help you need.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
4109
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
22
1496
by: OHM \( Terry Burns \) | last post by:
I was thinking about community the other day, and wondering what would be the holy grail for a developer in need. I mean, we do get help here, but its done on a best endeavours basis and its really really good most of the time. What Ideally would you guys like to see in the perfect community site which would help you out? -- OHM ( Terry Burns ) * Use the following to email me *
5
1566
by: Grant Olson | last post by:
I'm feeling a little guilty here. I spent a lot of my free time last year working on an x86 compiler for python. I made a reasonable amount of progress, but my interests wandered off into other areas. I basically just got bored and stopped working on the thing maybe 6 months ago. So today, I went to the directory that contains all of my source checkouts, and saw this v 0.1 compiler just sitting out there AGAIN. It's not that I don't...
5
2031
by: bean330 | last post by:
Hey, I'm somewhat new to C# and I need a little help, please! I'm selecting a bunch of records, setting properties on a COM executable and then calling a method on that executable to run. I want to run the executable in separate threads because they can be long-running and it would be optimal for us to run a bunch simultaneously. I've got that part working - it's pretty easy in C#. What I'm having a hard time with is managing the...
6
2196
by: shapper | last post by:
Hello, I am creating a form that includes a few JQuery scripts and TinyMCE Editor: http://www.27lamps.com/Beta/Form/Form.html I am having a few problems with my CSS: 1. Restyling the Select
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6765
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.