Reply to Create Pulldown Menus for Month/Day/Year in HTA

Your name:

Reply:


Posted by Highlander on 12/29/06 15:31

Hello all. Consider the following HTA:

<html>
<head>
<title>Date Pulldowns</title>
<HTA:APPLICATION
ID="HTAUI"
APPLICATIONNAME="Date Pulldowns"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximized">
</head>

<SCRIPT language="VBScript">
Dim fromMonth, fromDay, fromYear, toMonth, toDay
Dim toYear, fromDate, toDate
Sub Window_Onload
self.Focus()
self.ResizeTo 400,200
self.MoveTo 400,150
End Sub

Sub FromMonthSelectSub
fromMonth = FromMonthSelection.Value
End Sub

Sub FromDaySelectSub
fromDay = FromDaySelection.Value
End Sub

Sub FromYearSelectSub
fromYear = FromYearSelection.Value
End Sub

Sub ToMonthSelectSub
toMonth = ToMonthSelection.Value
End Sub

Sub ToDaySelectSub
toDay = ToDaySelection.Value
End Sub

Sub ToYearSelectSub
toYear = ToYearSelection.Value
End Sub

Sub DisplayDatesSub
fromDate = fromMonth & "/" & fromDay & "/" & fromYear
toDate = toMonth & "/" & toDay & "/" & toYear
MsgBox "From:" & vbTab & fromDate & vbCrlf & "To:" & vbTab & toDate
End Sub
</SCRIPT>

<BODY STYLE="font:6 pt arial; color:white;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000000', EndColorStr='#0000FF')">
<p align="left"><font face="serif" size="4"><b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
From:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
To:
<br>
<align="left">
<select id="FromMonthSelection" onChange="FromMonthSelectSub">
<option value="0"></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>

<select id="FromDaySelection" onChange="FromDaySelectSub">
<option value="0"></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>

<select id="FromYearSelection" onChange="FromYearSelectSub">
<option value="0"></option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
</select>
&nbsp;&nbsp;

<align="left">
<select id="ToMonthSelection" onChange="ToMonthSelectSub">
<option value="0"></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>

<select id="ToDaySelection" onChange="ToDaySelectSub">
<option value="0"></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>

<select id="ToYearSelection" onChange="ToYearSelectSub">
<option value="0"></option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
</select>

<p align="left">
<input id=DisplayDatesButton type="button" value="Display Dates"
name="DisplayDates_button"
onClick="DisplayDatesSub">
<p>
</BODY>
</html>

The script works fine, but I'm wondering if there's any way to
dynamically populate the pulldown lists with all the months of the
year, days of the month, etc. - rather than have to list each one out
like this:

<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
etc.
etc.
etc.

Any suggestions would be greatly appreciated.
Thanks!

- Dave

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация