473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do i change this code so that when a certain date is entered it goes to URL?

I found this code and would like to make it so that if a person is checking availability for something, when the correct date is selected, it goes to a URL. Example, click DEC. 18 2010 and it goes to one URL, Dec.19 2010 and it goes to another. or Dec. 18 2011 and it goes to another. I dont understand how to correlate all that. any help would be much appreciated!

Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  3. <title>New Page 1</title>
  4. </head>
  5.  
  6.  
  7. <script>
  8. //to check leap year
  9. function checkleapyear(datea)
  10. {
  11. datea = parseInt(datea);
  12.  
  13. if(datea%4 == 0)
  14. {
  15. if(datea%100 != 0)
  16. {
  17. return true;
  18. }
  19. else
  20. {
  21. if(datea%400 == 0)
  22. return true;
  23. else
  24. return false;
  25. }
  26. }
  27. return false;
  28. }
  29. //to populate drop drow boxex with the current month and date
  30. function populateYearSelect()
  31. {
  32. d = new Date();
  33. curr_year = d.getFullYear();
  34. curr_month=d.getMonth();
  35.  
  36. document.getElementById('month').options[curr_month].selected=true;
  37. for(i = 0; i < 3; i++)
  38. {
  39. document.getElementById('year').options[i] = new Option(curr_year-i,curr_year-i);
  40. }
  41.  
  42.  
  43. if(curr_month==0 || curr_month==2 ||curr_month==4 || curr_month==6 || curr_month==7 || curr_month==9 || curr_month===11)
  44. {
  45. for(i=0;i<=30;i++)
  46.  
  47. document.getElementById('day').options[i] = new Option(i+1,i+1);
  48.  
  49. }
  50.  
  51. else if(curr_month==3 || curr_month==5 ||curr_month==8 || curr_month==10)
  52. {
  53. for(i=0;i<=29;i++)
  54.  
  55. document.getElementById('day').options[i] = new Option(i+1,i+1);
  56.  
  57.  
  58. }
  59.  
  60. if(curr_month==1)
  61. {
  62. var year=document.getElementById('year').value;
  63.  
  64.  
  65. if(checkleapyear(year))
  66. { for(i=0;i<=28;i++)
  67. document.getElementById('day').options[i] = new Option(i+1,i+1); }
  68. else
  69. { for(i=0;i<=27;i++)
  70. document.getElementById('day').options[i] = new Option(i+1,i+1);}
  71.  
  72. }
  73.  
  74. }
  75.  
  76.  
  77.  
  78. </script>
  79.  
  80. <body onLoad="populateYearSelect()">
  81.  
  82.  
  83. <select name="year" id="year" >
  84. </select>
  85.  
  86. <select name="month" id="month">
  87. <option value=01>JAN</option>
  88. <option value=02>FEB</option>
  89. <option value=03>MAR</option>
  90. <option value=04>APR</option>
  91. <option value=05>MAY</option>
  92. <option value=06>JUN</option>
  93. <option value=07>JUL</option>
  94. <option value=08>AUG</option>
  95. <option value=09>SEP</option>
  96. <option value=10>OCT</option>
  97. <option value=11>NOV</option>
  98. <option value=12>DEC</option>
  99. </select>
  100.  
  101. <select name="day" id="day">
  102. </select>
  103.  
  104. </body>
  105.  
  106.  
  107.  
  108. </html>
  109.  
Nov 6 '10 #1
3 2822
Well, you could send the form as GET and it would be like page?year=2010&month=JAN&day=1, for example.

I don't know how you'll be using the data afterward so I can't help much.

But this is a good start:

Expand|Select|Wrap|Line Numbers
  1. <body onLoad="populateYearSelect()">
  2.  
  3.  
  4. <form action="" method="GET">
  5.  
  6. <select name="year" id="year" >
  7. </select>
  8.  
  9. <select name="month" id="month">
  10. <option value=01>JAN</option>
  11. <option value=02>FEB</option>
  12. <option value=03>MAR</option>
  13. <option value=04>APR</option>
  14. <option value=05>MAY</option>
  15. <option value=06>JUN</option>
  16. <option value=07>JUL</option>
  17. <option value=08>AUG</option>
  18. <option value=09>SEP</option>
  19. <option value=10>OCT</option>
  20. <option value=11>NOV</option>
  21. <option value=12>DEC</option>
  22. </select>
  23.  
  24. <select name="day" id="day">
  25. </select>
  26.  
  27. <input type="submit" />
  28. </form>
  29. </body>
  30.  
  31.  
Again, what are you going to do next? There are other ways of doing what you asked, I don't know what's the best for you.
Nov 6 '10 #2
drhowarddrfine
7,435 Expert 4TB
This must be done with javascript so this thread should be moved to that board.
Nov 6 '10 #3
numberwhun
3,509 Expert Mod 2GB
It has been moved.

Regards,

Jeff
Nov 7 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ovidiu | last post by:
How can I get all files in a project that were checked in until a certain date/time ?
5
by: Martien van Wanrooij | last post by:
I would like to retrieve, let us say, the First Monday after a certain date, so my (imaginary) function could be something like echo weekdayAfter("28 July 2005", "Monday") should return "1 August...
7
by: simonmarkjones | last post by:
Hi, I have a report i would like created based upon a date the user types in. I have a query which in the criteria section of my date field i have put . The report is created fine when a...
4
by: wil | last post by:
Dear All, In the linux platform, is there anyway I can in a C program change the file create date? Thanks, wil.
4
by: Mark | last post by:
Hi All, I'm trying my hardest to learn VBA but have run into a problem which hopefully someone can guide me with. Basically what I am trying to achieve is to get the database to check the users...
2
by: dermot | last post by:
hi, I'm opening a file dialog in a vb.net form. I want to show only files modified after a certain date. Is there anyway to filter for this? Thanks
9
by: simba | last post by:
Hi, I am doing an online booking project and was wondering if anyone has any ideas on how I can display rooms that are not booked on a certain date. The query that I have that displays all rooms...
2
by: neeZy | last post by:
Hey Guys, I have a make-table query in which I'm tryin to display a table that shows results past a certain date (12/31/2006). The date column is in proper Date/Time format - Short Date format to...
9
by: Millie18 | last post by:
Hi, I’m trying to set up a query to find all dates on or between a start and end date. Table name and field names I’ve used: Tbl_bookings Booking No Boarding Arrival Date Boarding Departure...
1
by: Fan Zhang | last post by:
Dear All: Is it possible that someone can kindly tell me how to detect the change of a certain cell? environment is VSTO + VS 2008 + EXCEL 2007. the Globals.sheet1.Calculate += is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.