By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

Create Pulldown Menus for Month/Day/Year in HTA

P: n/a
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;&n bsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&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

Dec 29 '06 #1
Share this Question
Share on Google+
20 Replies


P: n/a

Highlander wrote:
Consider the following HTA:
I'd rather not. You posted it to c.i.w.a.h where it's off-topic
because:

It's a HTA (spawn of pure evil) rather than HTML
It's a HTML, thus not suitable for "web" use, as opposed to M$'s little
play-nice-with-everyone sandpit.
It uses VBScript so it's IE-restricted
The HTML is a bit poor
The CSS is a bit poor

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:
HTML isn't a programming language, it's fundamentally a static text
markup language. So stick static things into it statically.

If you want to generate this programmatically (probably overkill for
days and months, but the principle isn't bad) then do it with some
server-side program that's _external_ to the HTML document itself (and
it's only a line or two of ASP, even ASP/VBScript).

Embedding executables into static documents is only sensible if you're
deliberately trying to obfuscate things, or you're drawing Hilbert
curves.

Dec 29 '06 #2

P: n/a
"Highlander" <tr******@msn.comwrote in message
news:11*********************@k21g2000cwa.googlegro ups.com...
Hello all. Consider the following HTA:
[snip]
>
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.

Will this help? This cuts the code size in half.

<html>
<head>
<title>Date Pulldowns</title>
<HTA:APPLICATION
ID="HTAUI"
APPLICATIONNAME="Date Pulldowns"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximized">
<script type="text/vbscript">
Option Explicit
'*
Const cOPT = "<option value='?'>?</option>"
'*
Dim fromMDY(2)
Dim toMDY(2)
Dim optMDY(2)
optMDY(0) = "<option value='0'></option>"
optMDY(1) = "<option value='0'></option>"
optMDY(2) = "<option value='0'></option>"
Dim i
'*
For i = 1 To 12
optMDY(0) = optMDY(0) & vbCrLf & Replace(cOPT,"?",i)
Next
For i = 1 To 31
optMDY(1) = optMDY(1) & vbCrLf & Replace(cOPT,"?",i)
Next
For i = Year(Date)+1 To Year(Date)-4 Step -1
optMDY(2) = optMDY(2) & vbCrLf & Replace(cOPT,"?",i)
Next

Sub Selected(What)
Select Case What
Case "FromMonth"
fromMDY(0) = FromMonth.Value
Case "FromDay"
fromMDY(1) = FromDay.Value
Case "FromYear"
fromMDY(2) = FromYear.Value
Case "ToMonth"
toMDY(0) = ToMonth.Value
Case "ToDay"
toMDY(1) = ToDay.Value
Case "ToYear"
toMDY(2) = ToYear.Value
End Select
End Sub

Sub DisplayDates()
MsgBox "From:" & vbTab & Join(fromMDY,"/") & vbCrlf _
& "To:" & vbTab & Join(toMDY,"/")
End Sub

Sub Window_Onload()
self.Focus()
self.ResizeTo 400,200
self.MoveTo 400,150
End Sub
</script>
</head>
<body style="font:6 pt arial; color:white;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000000', EndColorStr='#0000FF')">
<font face="serif" size="4">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>From:</b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
&nbsp;&nbsp;
<b>To:</b>
<br>
<select id="FromMonth" onChange="Selected('FromMonth')">
<script type="text/vbscript">
document.write(optMDY(0))
</script>
</select>

<select id="FromDay" onChange="Selected('FromDay')">
<script type="text/vbscript">
document.write(optMDY(1))
</script>
</select>

<select id="FromYear" onChange="Selected('FromYear')">
<script type="text/vbscript">
document.write(optMDY(2))
</script>
</select>

&nbsp;&nbsp;

<select id="ToMonth" onChange="Selected('ToMonth')">
<script type="text/vbscript">
document.write(optMDY(0))
</script>
</select>

<select id="ToDay" onChange="Selected('ToDay')">
<script type="text/vbscript">
document.write(optMDY(1))
</script>
</select>

<select id="ToYear" onChange="Selected('ToYear')">
<script type="text/vbscript">
document.write(optMDY(2))
</script>
</select>

<br><br>
<input type="button" value="Display Dates" onClick="DisplayDates()">
</body>
</html>
There's no such tag as <align="left">
(it's the default alignment anyway)
and you use of &nbsp;
for spacing is not recommended;
consider using a <table>.

Also, you may want to use 2-digit months and days.
Dec 29 '06 #3

P: n/a
"Andy Dingley" <di*****@codesmiths.comwrote in message
news:11**********************@k21g2000cwa.googlegr oups.com...
>
Highlander wrote:
Consider the following HTA:

I'd rather not. You posted it to c.i.w.a.h where it's off-topic
because:

It's a HTA (spawn of pure evil) rather than HTML
Huh?
It's a HTML, thus not suitable for "web" use, as opposed to M$'s little
play-nice-with-everyone sandpit.
HTA's are (primarily) meant to run locally.
It uses VBScript so it's IE-restricted
So, this is a VBScript newsgroup.
The HTML is a bit poor
Agreed.
The CSS is a bit poor
Agreed.
>
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:

HTML isn't a programming language, it's fundamentally a static text
markup language. So stick static things into it statically.
VBScript is the programming language.
If you want to generate this programmatically (probably overkill for
days and months, but the principle isn't bad) then do it with some
server-side program that's _external_ to the HTML document itself (and
it's only a line or two of ASP, even ASP/VBScript).
HTA's are not an ASP topic.
Embedding executables into static documents is only sensible if you're
deliberately trying to obfuscate things, or you're drawing Hilbert
curves.
Huh? What does this have to do with anything?
Dec 29 '06 #4

P: n/a
"McKirahan" <Ne**@McKirahan.comwrites:
"Andy Dingley" <di*****@codesmiths.comwrote in message
news:11**********************@k21g2000cwa.googlegr oups.com...
>It uses VBScript so it's IE-restricted

So, this is a VBScript newsgroup.
What part of comp.infosystems.www.authoring.HTML, or alt.HTML do you not
understand?

You cross-posted this to three groups; one of them is relevant, the others
are not. Followups set.
>HTML isn't a programming language, it's fundamentally a static text
markup language. So stick static things into it statically.

VBScript is the programming language.
You posted to two different HTML groups also.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Dec 29 '06 #5

P: n/a
McKirahan,

Thanks for your suggestions!

Andy Dingley wrote:
Highlander wrote:

Consider the following HTA:

I'd rather not. You posted it to c.i.w.a.h where it's off-topic
Sherm Pendley wrote:
You cross-posted this to three groups; one of them is relevant, the others
are not. Followups set.
....

Off-topic? Not relevant?

A search in comp.infosystems.www.authoring.html for the word "HTA":
39 results

A search in alt.html for the word "HTA":
70 results

Furthermore, a "date picker" pulldown menu of Month/Day/Year selections
is a *very* common element on websites; so it stands to reason that
HTML related newsgroups (such as these two that I posted to) just might
have info on this type of dropdown.

Dec 29 '06 #6

P: n/a
Replied to [Highlander]s message :
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>

I am not very good at VBs so i made this in Js. Insert this at top of your VBS script
tag :

There is a variable named elementNames.. The syntax is like :
"ID of element|LengthAndValueOptions,ID|LengthAndValue etc.etc...

<script language="JScript">
window.onload=Makee
elementNames="FromDaySelection|31,FromMonthSelecti on|12,ToMonthSelection|12,ToDaySelection|31"

function Makee(){
eN=elementNames.split(",");numm=new Array()
for(indX=0;indX<eN.length;indX++){
numm[indX]=parseInt(eN[indX].substring(eN[indX].length-2,eN[indX].length))
eN[indX]=document.getElementById(eN[indX].substring(0,eN[indX].length-3));
}
for(aIx=0;aIx<eN.length;aIx++){
con = document.createElement("option");
eN[aIx].options.add(con);
for(aIxx=1;aIxx<(numm[aIx]+1);aIxx++){
cTion = document.createElement("option");
eN[aIx].options.add(cTion);
cTion.innerText = aIxx;
cTion.value = aIxx;
}}}
</script>

Dec 29 '06 #7

P: n/a
Highlander wrote:
McKirahan,

Thanks for your suggestions!

Andy Dingley wrote:
>Highlander wrote:
>>Consider the following HTA:
I'd rather not. You posted it to c.i.w.a.h where it's off-topic

Sherm Pendley wrote:
>You cross-posted this to three groups; one of them is relevant, the others
are not. Followups set.

...

Off-topic? Not relevant?

A search in comp.infosystems.www.authoring.html for the word "HTA":
39 results
A topic of discussion doesn't become on-topic in a newsgroup because
people may mention it in passing while discussing something that is on
topic, or because other people have already raised it in off-topic postings.

HTA is for running apps on local computers. C.i.w.a.h is about authoring
HTML for the Web. They're mutually exclusive.
A search in alt.html for the word "HTA":
70 results
Alt.html is about anything HTML related, so I don't see any problem with
bringing up the topic there. OMMV (others' mileage may vary).
>
Furthermore, a "date picker" pulldown menu of Month/Day/Year selections
is a *very* common element on websites;
but not as an HTA.
so it stands to reason that
HTML related newsgroups (such as these two that I posted to) just might
have info on this type of dropdown.
People in a wine newsgroup might know something about cheese, but ask a
cheese-related question in a cheese newsgroup and leave the wine
newsgroup for people to discuss wine. Otherwise the point of having
separate newsgroups for so many topics is kind of defeated.

It's one thing if there isn't *any* obvious newsgroup to post a question
in, or if a newsgroup specific to the subject exists but has no traffic
other than spammers. But this isn't one of those situations. Frankly, I
would think that one of the microsoft.* newsgroups related to
"inetexplorer" would be the best bet.
Dec 29 '06 #8

P: n/a
Replied to [Harlan Messinger] :

Can you tell me which server are you using to subscribe to this NG ?

→ Ayush
Dec 29 '06 #9

P: n/a
It's not clear whether you've got your
answer yet, in all this confusion. :)

So just in case....
In addition to McKirihan's method of
looping through pre-existing options, you
can also load them and clear them dynamically.

It's awkward because it's non-intuitive.
The DOM treats an option as an object, so you have
to "create" them and add them to a SELECT::

Dim Opt

Set Opt = document.createElement("OPTION")
Opt.text = '-- text of option here.
Opt.value = '-- hidden value here.
FromMonthSelection.add Opt
Set Opt = Nothing

To clear options just use:

FromMonthSelection.length = 0


Dec 30 '06 #10

P: n/a
VK

Harlan Messinger wrote:
HTA is for running apps on local computers.
"HTML Applications (HTAs)"
see also
<http://msdn.microsoft.com/workshop/author/hta/overview/htaoverview.asp#Deployment>
C.i.w.a.h is about authoring
HTML for the Web. They're mutually exclusive.
from c.i.w.a.h. charter:
"This newsgroup covers discussion of HyperText Markup Language (HTML)
as it relates to web page authoring. Possible subjects include HTML
editors, formatting tricks, and current and proposed HTML standards."

see also <http://www.stack.nl/~boris/HTML/ciwahfaq.html>

If you don't like the charter of some Usenet group then simply don't
participate in such group or state your private opinion as a _private_
one, like "despite of what the charter says I consider... etc."
Alt.html is about anything HTML related, so I don't see any problem with
bringing up the topic there. OMMV (others' mileage may vary).
As well as c.i.w.a.h. But the group description says "Use
comp.infosystems.www.authoring.html instead."
<http://groups.google.com/group/alt.html/aboutThe reason why no one
follows this advise is clear from reading just a few "friendly and
useful" crap sh** posts as in this thread.
Furthermore, a "date picker" pulldown menu of Month/Day/Year selections
is a *very* common element on websites;
Here I would contest OP: it is a common *programmed widget* so it is in
direct relations with client-side programming rather than with HTML
markup. This way JavaScript, JScript and VBScript groups are the most
relevant for the question.

<snip crap>

Dec 30 '06 #11

P: n/a
In microsoft.public.scripting.vbscript message <1167406316.195202.84900@
k21g2000cwa.googlegroups.com>, Fri, 29 Dec 2006 07:31:56, Highlander
<tr******@msn.composted:
>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
>Any suggestions would be greatly appreciated.
Well, you could read the news:c.l.j FAQ on the subject of dates.

Your job is done using javascript in my js-date6.htm#YMD, including only
offering the right number of days for the selected month. There is also
code for year-week-day numbering, using standard weeks.

But you should consider whether all likely users will have scripting
enabled.

FU set.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Dec 30 '06 #12

P: n/a
Dan
Highlander wrote:
Furthermore, a "date picker" pulldown menu of Month/Day/Year selections
is a *very* common element on websites; so it stands to reason that
HTML related newsgroups (such as these two that I posted to) just might
have info on this type of dropdown.
And it's perfectly possible to create one in standard HTML, without any
need for all of that HTA / VBScript fecal matter.

--
Dan

Dec 30 '06 #13

P: n/a
"VK" <sc**********@yahoo.comwrites:
Harlan Messinger wrote:
>HTA is for running apps on local computers.

"HTML Applications (HTAs)"
see also
<http://msdn.microsoft.com/workshop/author/hta/overview/htaoverview.asp#Deployment>
>C.i.w.a.h is about authoring
HTML for the Web. They're mutually exclusive.

from c.i.w.a.h. charter:
"This newsgroup covers discussion of HyperText Markup Language (HTML)
as it relates to web page authoring. Possible subjects include HTML
editors, formatting tricks, and current and proposed HTML standards."
The key point there is "as it relates to web page authoring". The entire
comp.infosystems.www.* hierarchy is meant for discussion of (surprise) the
WWW itself. Many technologies upon which the WWW is based - HTML, GIF and
JPEG images, etc. - are also used in other contexts. That does not make
discussion of those other contexts relevant to the c.i.w.* groups.

Although they use some of the same technologies, HTAs are not web pages. Not
even MS claims that they are - the very first paragraph of the link you gave
above states quite clearly that they are not:

The power to build HTML Applications (HTAs) brings Microsoft Internet
Explorer 5 to the fore as a viable Microsoft Windows development platform.
HTAs are full-fledged applications.

There you go, right from the horse's mouth - HTA are applications for MS
Windows, not web pages. The very next sentence reinforces that point:

These applications are trusted and display only the menus, icons,
toolbars, and title information that the Web developer creates.

HTAs and web pages are, despite their common use of HTML as a display format,
built around entirely different sets of assumptions. I would think it common
sense to ask one's question in a group where everyone is reading from the
same play book. HTA and web page authors are very clearly not doing that.

Granted, there is a substantial amount of overlap, and I for one would not
take issue with any question regarding standard HTML being posted here,
regardless of whether it was being used in a web page or in an HTA. But the
OP's question concerning VBScript was very clearly off-topic for this group.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Dec 30 '06 #14

P: n/a
VK
Sherm Pendley wrote:
from c.i.w.a.h. charter:
"This newsgroup covers discussion of HyperText Markup Language (HTML)
as it relates to web page authoring. Possible subjects include HTML
editors, formatting tricks, and current and proposed HTML standards."

The key point there is "as it relates to web page authoring".
Right: "web page authoring", not "authoring for the Web" or so. You may
want to refresh in your memory the definition of a "web page" /
"webpage". If you don't have any printed dictionary handy right at this
second, <http://en.wikipedia.org/wiki/Webpagemay go for a temporary
source.
The entire
comp.infosystems.www.* hierarchy is meant for discussion of (surprise) the
WWW itself.
Abstract questions like "WWW itself" should be discussed IMO on
comp.infosystems.www.misc or similar. What is allowed to discuss at
<comp.infosystems.www.authoring.htmlis defined in the newsgroup
charter.
Many technologies upon which the WWW is based - HTML, GIF and
JPEG images, etc. - are also used in other contexts. That does not make
discussion of those other contexts relevant to the c.i.w.* groups.
"This newsgroup covers discussion of HyperText Markup Language (HTML)
as it relates to web page authoring. Possible subjects include HTML
editors, formatting tricks, and current and proposed HTML standards."

As long as the question fits in here it should be welcome.
Although they use some of the same technologies, HTAs are not web pages. Not
even MS claims that they are - the very first paragraph of the link you gave
above states quite clearly that they are not:
Did you see a single HTA page in your life? HTA 99% _is_ the same HTML
document but with .hta extension. There can be a complicated HTA
perfectly validating through W3C Validator as say HTML 4.01 Strict
There you go, right from the horse's mouth - HTA are applications for MS
Windows, not web pages. The very next sentence reinforces that point:
See the previous comment.
I just love people who don't learn other things - but they know that
all these things a terribly wrong - just because there can be only one
thing which is right, and this is the thing they already know about.

Dec 31 '06 #15

P: n/a
"VK" <sc**********@yahoo.comwrites:
I just love people who don't learn other things
Yeah, like the difference between an application and a web page.

Moron.

*plonk*

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Dec 31 '06 #16

P: n/a

Highlander wrote:
Hello all. Consider the following HTA:
[...]
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:
Given that:

1. You can't control the order of selection so using script to modify
date selects rapidly becomes overly complex.
2. Users without scripting available or enabled (or an incompatible
browser) can't enter a date at all
3. Many users find "date selects" annoying

why not just let the user enter a normal date in a text input?

--
Rob

Jan 1 '07 #17

P: n/a
VK
I just love people who don't learn other things
>
Yeah, like the difference between an application and a web page.
Poor child, did you ever meet "web application" yet? If not then now
it's your best chance:
<http://www.google.com/search?hl=en&q=web+application+site%3Aw3.org&btnG= Google+Search>
Moron.
Half-wit

Jan 2 '07 #18

P: n/a

mr_unreliable wrote:
hi Highlander,

I'm impressed with all that html to get the date,
but why not let microsoft do the work?

Microsoft has a "date-picker" control which has
good-looking graphics, and is familiar to anybody
who uses windows.

If you have a recent version of vb (or maybe even
vba) you will have "date-picker" available, and
it is scriptable via an actX interface.

Microsoft's (vb) date-picker is located in mscomct2.ocx.
There is a demo script attached which shows how to
use it.

There is more. Microsoft also published a msCalender
control (mscal.ocx). There is also a demo script
(hta) attached, in case you happen to have the mscal
control on your system. (I personally like the DTP
better).

Returning to the date-picker control, if you _don't_
happen to have microsoft's control installed, there
are several other versions published. I happen to
like the ccrp's (Common Control Replacement Project)
-- a group of guys (sorry, no gals) who are so arrogant
that they think they can do a better job with the controls
than microsoft, and generally succeeded.

Here is a reference to the ccrp "date-picker" control,
which they call the "Date/Time-Picker":

http://ccrp.mvps.org/index.html?controls/ccrpdtp6.htm

It is also an actX control and you ought to be able
to instantiate it on an hta page and also script it,
even though I don't have a demo of that.

cheers, jw
__________________________________________________ __________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
p.s. I have also seen html/dhtml versions of the
date-picker control, but why bother?

Highlander wrote:
Any suggestions would be greatly appreciated.
Thanks!

- Dave

--------------040709090300030903000607
Content-Type: text/plain
Content-Disposition: inline;
filename="demoMSDTPickerControl.hta.txt"
X-Google-AttachSize: 1702

<HTML>
<HEAD>

<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="Show_msCAL"
WINDOWSTATE="normal" SCROLL = "no" BORDERSTYLE="normal" BORDER="thin"
CAPTION="yes" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="no" ICON="mru.ico"
SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" VERSION="1.0" >

<TITLEdemo msDateTimePicker control </TITLE>
<!--
' --- description block --------------------------
'
' Title: an HTA to demo ms Date-Picker control...
'
' Description: allows the user to pick a date...
'
' Author: mr_unreliable
' Website: none at present,
' (but may be found lurking around wsh/vbs ng)...
'
' Usage: Use at you own risk, tested on win98se...
'
' --- revision history ---------------------------
' 29Dec06: initial attempt...
' --- end of description block -------------------
-->

<SCRIPT language="vbscript">
' (global code: resize the window)...
window.ResizeTo 350,300

Sub btnReadDate_onClick()
' MsgBox("click event detected")
MsgBox("The msCAL control reads: " & vbCrLf & vbCrLf _
& CStr(oDTP.Month) & "/" & CStr(oDTP.Day) & "/" _
& CStr(oDTP.Year))
End Sub
</SCRIPT>
</HEAD>

<BODY bgcolor="silver" style="font:10pt verdana">
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
<OBJECT ID="oDTP" WIDTH=250 HEIGHT=25
CLASSID="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1">
<PARAM NAME="CalendarTitleBackColor" VALUE="-2147483646">
<PARAM NAME="CalendarTitleForeColor" VALUE="-2147483639">
</OBJECT>
<BR><BR><BR>
<p>Note: to show the date-time-picker graphic,
you must click on the down arrow to the right of
the textbox above. </p>

<BR><BR><BR><BR><BR>
<BUTTON id="btnReadDate" Read the Date from msDTP Control </BUTTON>
</BODY>
</HTML>

--------------040709090300030903000607
Content-Type: text/plain
Content-Disposition: inline;
filename="demoMSCALControl.hta.txt"
X-Google-AttachSize: 1378

<HTML>
<HEAD>

<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="Show_msCAL"
WINDOWSTATE="normal" SCROLL = "no" BORDERSTYLE="normal" BORDER="thin"
CAPTION="yes" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="no" ICON="mru.ico"
SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" VERSION="1.0" >

<TITLEdemo msCAL control </TITLE>
<!--
' --- description block --------------------------
'
' Title: an HTA to demo msCAL control...
'
' Description: allows the user to pick a date...
'
' Author: mr_unreliable
' Website: none at present,
' (but may be found lurking around wsh/vbs ng)...
'
' Usage: Use at you own risk, tested on win98se...
'
' --- revision history ---------------------------
' 29Dec06: initial attempt...
' --- end of description block -------------------
-->

<SCRIPT language="vbscript">
' (global code: resize the window)...
window.ResizeTo 350,300

Sub btnReadDate_onClick()
' MsgBox("click event detected")
MsgBox("The msCAL control reads: " & vbCrLf & vbCrLf _
& CStr(oMSCAL.Month) & "/" & CStr(oMSCAL.Day) & "/" _
& CStr(oMSCAL.Year))
End Sub
</SCRIPT>
</HEAD>

<BODY bgcolor="silver" style="font:10pt verdana">

<OBJECT ID="oMSCAL" WIDTH=288 HEIGHT=192
CLASSID="CLSID:8E27C92B-1264-101C-8A2F-040224009C02">
</OBJECT>

<BR><BR><BR>
<BUTTON id="btnReadDate" Read the Date from msCAL Control </BUTTON>
</BODY>
</HTML>

--------------040709090300030903000607--
JW,

This is exactly what I was looking for! Selecting dates is now much
more efficient, there's built-in date validation, and you've cut my
script down from 181 lines to 56:

<html>
<head>
<title>Date Pulldowns</title>
<HTA:APPLICATION
ID="HTAUI"
APPLICATIONNAME="Date Pulldowns"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximized">
</head>
<SCRIPT language="VBScript">
Dim fromDate, toDate
Sub Window_Onload
self.Focus()
self.ResizeTo 400,200
self.MoveTo 400,150
End Sub
Sub DisplayDatesSub
fromDate = CStr(FromDTP.Month) & "/" & CStr(FromDTP.Day) & "/" & _
CStr(FromDTP.Year)
toDate = CStr(ToDTP.Month) & "/" & CStr(ToDTP.Day) & "/" & _
CStr(ToDTP.Year)
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')">
<font face="serif" size="4"><b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
FROM:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
&nbsp;&nbsp;
TO:
<br>
<OBJECT ID="FromDTP" WIDTH=125 HEIGHT=25
CLASSID="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1">
<PARAM NAME="CalendarTitleBackColor" VALUE="-2147483646">
<PARAM NAME="CalendarTitleForeColor" VALUE="-2147483639">
</OBJECT>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
<OBJECT ID="ToDTP" WIDTH=125 HEIGHT=25
CLASSID="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1">
<PARAM NAME="CalendarTitleBackColor" VALUE="-2147483646">
<PARAM NAME="CalendarTitleForeColor" VALUE="-2147483639">
</OBJECT>
<p>
<input id=DisplayDatesButton type="button" value="Display Dates"
name="DisplayDates_button"
onClick="DisplayDatesSub">
<p>
</BODY>
</html>

One question jw. When the script opens the date fields display the
current date. After I've made some selections of different dates, is
there any way to programatically (VBScript) reset the date display to
the current date? Thanks.

And thanks to everyone else who had offered their suggestions.

- Dave

Jan 2 '07 #19

P: n/a
VK wrote:
Sherm Pendley wrote:
>>from c.i.w.a.h. charter:
"This newsgroup covers discussion of HyperText Markup Language (HTML)
as it relates to web page authoring. Possible subjects include HTML
editors, formatting tricks, and current and proposed HTML standards."
The key point there is "as it relates to web page authoring".

Right: "web page authoring", not "authoring for the Web" or so. You may
want to refresh in your memory the definition of a "web page" /
"webpage". If you don't have any printed dictionary handy right at this
second, <http://en.wikipedia.org/wiki/Webpagemay go for a temporary
source.
Wikipedia isn't authoritative.

A page that won't work on the Web can hardly be considered a web page.
Not everything written with HTML (*especially* when it's a bastardized
form of HTML) is a web page, any more than everything written in Java is
an applet.
Jan 4 '07 #20

P: n/a
Harlan Messinger wrote:
VK wrote:
>Sherm Pendley wrote:
>>>from c.i.w.a.h. charter:
"This newsgroup covers discussion of HyperText Markup Language (HTML)
as it relates to web page authoring. Possible subjects include HTML
editors, formatting tricks, and current and proposed HTML standards."
The key point there is "as it relates to web page authoring".

Right: "web page authoring", not "authoring for the Web" or so. You may
want to refresh in your memory the definition of a "web page" /
"webpage". If you don't have any printed dictionary handy right at this
second, <http://en.wikipedia.org/wiki/Webpagemay go for a temporary
source.

Wikipedia isn't authoritative.
In this case the opening sentence of the article contradicts you anyway.
"A web page or webpage is a resource of information that is suitable for
the World Wide Web and can be accessed through a web browser." An HTA
isn't suitable for the World Wide Web, and it can't be accessed through
a web browser. It works in IE, but that's because IE has features beyond
being a web browser.
Jan 4 '07 #21

This discussion thread is closed

Replies have been disabled for this discussion.