Hi:
Have a question on making the date automatically filled in by what the
user enters in by the date at the top.
The date entered at the top would most likely be on a Wednesday then I
need to have all the prior dates pop in. Example: User enters 2/9/05
in the date field at the top being a Wednesday...I need the dates at
the bottom to be filled in automatically, respectively as 2/3/05,
2/4/05, 2/5/05, 2/6/05, 2/7/05, 2/8/05, 2/9/05 above the days Thurs.,
Fri., Sat., Sun., Mon., Tues. and Wed. See text below as HTML. Thanks
very much in advanced for any ideas:
<HTML xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns="http://www.w3.org/TR/REC-html40">
<HEAD>
<TITLE>Outline Example</TITLE>
</HEAD>
<BODY>
<table border="1" width="100%" id="table13">
<tr>
<td width="424">Name:
<INPUT TYPE=text NAME="name_57" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
<td width="258">Date:
<INPUT TYPE=text NAME="name_58" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
<td>Job No:
<INPUT TYPE=text NAME="name_59" SIZE="20" MAXLENGTH="100"
VALUE=""></td>
</tr>
</table>
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
function reveal(s) {
var val = s.options[s.selectedIndex].value;
if (val > 1) {
for (var i = 2; i <= val; i++) {
if (document.getElementById) {
document.getElementById('recip_' + i).style.display = '';
} else if (document.all) {
document.all['recip_' + i].style.display = '';
}
}
} else {
for (var i = s.options.length; i > 1; i--) {
if (document.getElementById) {
document.getElementById('recip_' + i).style.display = 'none';
} else if (document.all) {
document.all['recip_' + i].style.display = 'none';
}
}
}
}
</SCRIPT> <tr>
<td width="103"> </td>
<td width="119"> </td>
<td width="123"> </td>
<td width="117"> </td>
<td> </td>
</tr>
</table> </DIV>
<table x:str border=0 cellpadding=0 cellspacing=0
style='border-collapse:
collapse;table-layout:fixed;width:741px' id="table4">
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td rowspan=4 height=100 style='border:medium none; padding:0px;
background:silver; height:75.8pt;color:windowtext; font-size:10.0pt;
font-weight:400; font-style:normal; text-decoration:none;
font-family:Arial; text-align:general; vertical-align:bottom;
white-space:nowrap' width="80"> </td>
<td style='border-left:.5pt solid windowtext; border-right:1.0pt
solid windowtext; border-top:medium none; border-bottom:.5pt solid
windowtext; padding:0px; width:80px; font-weight:700;
font-style:italic; font-family:Arial, sans-serif; text-align:center;
white-space:normal; color:windowtext; font-size:10.0pt;
text-decoration:none; vertical-align:bottom'>DATE</td>
<td align=left valign=top style="color: windowtext; font-size:
10.0pt; font-weight: 400; font-style: normal; text-decoration: none;
font-family: Arial; text-align: general; vertical-align: bottom;
white-space: nowrap; border: medium none; padding: 0px" width="325"
rowspan="4">
<table border="1" width="100%" id="table12" cellspacing="0"
cellpadding="0" bordercolorlight="#000000" height="120">
<tr>
<td width="42" align="center" height="30"> </td>
<td width="43" align="center" height="30"><b> </b></td>
<td width="44" align="center" height="30"> </td>
<td width="44" align="center" height="30"> </td>
<td width="45" align="center" height="30"> </td>
<td width="40" align="center" height="30"> </td>
<td align="center" height="30"> </td>
</tr>
<tr>
<td width="42" height="30" align="center"><b><font
size="2">THUR.</font></b></td>
<td height="30" width="43" align="center"><b><font
size="2">FRI.</font></b></td>
<td height="30" width="44" align="center"><b><font
size="2">SAT.</font></b></td>
<td height="30" width="44" align="center"><b><font
size="2">SUN.</font></b></td>
<td height="30" width="45" align="center"><b><font
size="2">MON.</font></b></td>
<td height="30" width="40" align="center"><b><font
size="2">TUES.</font></b></td>
<td height="30" align="center"><b><font
size="2">WED.</font></b></td>
</tr>
<tr>
<td width="42" height="30"> </td>
<td height="30" width="43"> </td>
<td height="30" width="44"> </td>
<td height="30" width="44"> </td>
<td height="30" width="45"> </td>
<td height="30" width="40"> </td>
<td height="30"> </td>
</tr>
<tr>
<td width="42" height="28"> </td>
<td height="28" width="43"> </td>
<td height="28" width="44"> </td>
<td height="28" width="44"> </td>
<td height="28" width="45"> </td>
<td height="28" width="40"> </td>
<td height="28"> </td>
</tr>
</table>
</td>
<td rowspan=4 style='border:medium none; padding:0px;
background:silver; color:windowtext; font-size:10.0pt; font-weight:400;
font-style:normal; text-decoration:none; font-family:Arial;
text-align:general; vertical-align:bottom; white-space:nowrap'
width="256"> </td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td height=25 style='border-left:.5pt solid windowtext;
border-right:1.0pt solid windowtext; border-top:medium none;
border-bottom:.5pt solid windowtext; padding:0px;
height:18.95pt;width:80px; font-weight:700; font-style:italic;
font-family:Arial, sans-serif; text-align:center; white-space:normal;
color:windowtext; font-size:10.0pt; text-decoration:none;
vertical-align:bottom'>DAY</td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td height=25 style='border-left:.5pt solid windowtext;
border-right:1.0pt solid windowtext; border-bottom:.5pt solid
windowtext; padding:0px; height:18.95pt;border-top:medium none; ;
font-weight:700; font-style:italic; font-family:Arial, sans-serif;
text-align:center; color:windowtext; font-size:10.0pt;
text-decoration:none; vertical-align:bottom; white-space:nowrap'
width="80">ROOM</td>
</tr>
<tr height=25 style='mso-height-source:userset;height:18.95pt'>
<td height=25 style='border-left:.5pt solid windowtext;
border-right:1.0pt solid windowtext; border-top:medium none;
border-bottom:1.0pt solid windowtext; padding:0px; height:18.95pt;
font-weight:700; font-style:italic; font-family:Arial, sans-serif;
text-align:center; color:windowtext; font-size:10.0pt;
text-decoration:none; vertical-align:bottom; white-space:nowrap'
width="80">BOARD</td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</BODY>
</HTML> 8 2214
I'm going to try to make this concept easier to answer since the above
is messy code please see my "hypothetical" example and tell me how I
can get dates automatically entered in with this HTML document:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<INPUT TYPE=text ID=Amount1 Name=Amount1 Value="""> Date gets
entered
here. Example user enters "2/9/05"<p> <INPUT TYPE=text
ID=Amount1 Name=Amount1 Value=""">
Thursday...."2/3/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount2 Name=Amount2 Value=""">
Friday....."2/4/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount3 Name=Amount3 Value=""">
Saturday...."2/5/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount4 Name=Amount4 Value=""">
Sunday...."2/6/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount5 Name=Amount5 Value=""">
Monday..."2/7/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount6 Name=Amount6 Value=""">
Tuesday...."2/8/05"
automatically fills in here.</p>
<p><INPUT TYPE=text ID=Amount7 Name=Amount7 Value=""">
Wednesday......"2/9/05" automatically fills in here.</p>
</body>
</html>
JRS: In article <11**********************@l41g2000cwc.googlegroups .com>
, dated Mon, 7 Feb 2005 07:42:21, seen in news:comp.lang.javascript,
netsurfer <ne**********@yahoo.com> posted : The date entered at the top would most likely be on a Wednesday then I need to have all the prior dates pop in. Example: User enters 2/9/05 in the date field at the top being a Wednesday...I need the dates at the bottom to be filled in automatically, respectively as 2/3/05, 2/4/05, 2/5/05, 2/6/05, 2/7/05, 2/8/05, 2/9/05 above the days Thurs., Fri., Sat., Sun., Mon., Tues. and Wed. See text below as HTML. Thanks very much in advanced for any ideas:
Read the newsgroup FAQ.
When posting code, do not allow your posting agent to wrap lines; code
should be executable as transmitted.
Don't post excess code. In particular, most scripts should work without
CSS, so strip out CSS and as much else as possible. Then test your
reduced page to check that it still shows what needs to be shown, and no
more.
Explain where your problem actually lies; does it lie in the execution
of code after data entry, or the computation of the dates, in the
representation as date strings, or in the emplacement of those strings?
Avoid FFF on the WWW.
Don't fix font sizes in points, it is a breach of the DDA, if you
provide a public service. http://validator.w3.org/ will probably give a number of warnings about
your HTML.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
netsurfer wrote: I'm going to try to make this concept easier to answer since the above is messy code please see my "hypothetical" example and tell me how I can get dates automatically entered in with this HTML document:
Thanks for cleaning up your code, at least a little.
[...] <INPUT TYPE=text ID=Amount1 Name=Amount1 Value="""> Date gets
All attributes should be quoted, and that extra " at the end
will upset most browsers.
You only need both id and name attributes on form elements under
certain circumstances, it is not needed here. Just use name.
And if you aren't going to give the input a value, why include an
empty value attribute? It's optional, it isn't required and
just gives more code to maintain (and you've got an error...)
I also would not use input fields for the generated dates as
users will likely try to modify them (unless you want your users
modifying the dates).
[...] Thursday...."2/3/05" automatically fills here.</p>
Do not assume US dates. Always specify input formats and units
where appropriate. Assume your users are really dumb (but don't
*treat* them as dumb). Make everything obvious with subtle but
concise and accurate help.
[...]
It seems you are trying to create a Hegira week - or am I way
off? The code below creates a set of dates from Thu to the
following Wed that includes the input date.
It does not validate the input - you need to do that. You need
to check that integers within an appropriate range have been
entered, I'll leave that up to you.
<html><head>
<title>Date Play</title>
<style type="text/css">
body {font-family: sans-serif;}
..dd {text-align: center;}
..od {text-align: right; border: 1px solid blue; width: 15em;}
</style>
<script type="text/javascript">
var months =
['January','February','March','April','May','June', 'July',
'August','September','October','November','Decembe r'];
var days = ['Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday']
function doDates(f) {
var slot; // will store a reference to the output element
// Get the input text and divide into bits
var dBits = f.startDate.value.split('-');
/* Code here to validate input
....
*/
// If passes validation, create a date at noon on date entered
var sDate = new Date(dBits[0],dBits[1]-1,dBits[2],'12');
// Go backward through week to Thursday
while ( days[sDate.getDay()] != days[4]) {
sDate.setDate(sDate.getDate()-1);
}
// Write the days of the week to the fields
for (var i=0; i<7; i++){
var dateString = days[sDate.getDay()]
+ ', ' + addZ(sDate.getDate())
+ ' ' + months[sDate.getMonth()]
+ ', ' + sDate.getFullYear();
// Get the field to write to
if (document.getElementById) {
slot = document.getElementById('day' + i);
} else if (document.all) {
slot = document.all('day' + i);
}
// See if slot has any child nodes. If so, remove them
while (slot.firstChild) {
slot.removeChild(slot.firstChild);
}
// Add a text node with the date string in it
slot.appendChild(document.createTextNode(dateStrin g));
// Add one day to the date
sDate.setDate(+sDate.getDate()+1);
}
}
// Adds a leading zero to single digit numbers
function addZ(x) {
return (x<10)? '0'+x:x;
}
</script>
</head>
<body>
<form action="">
<table>
<tr>
<td class="dd">Enter the start date<br>(yyyy-mm-dd):</td>
<td class="dd"><INPUT TYPE="text" id="startDate"
name="startDate" value="2005-02-09"><br>
<INPUT TYPE="button" value="Set dates" onclick="
doDates(this.form);
">
<input type="reset">
</td>
</tr>
<tr>
<td class="dd">Dates:</td>
<td>
<p class="od">
<span id="day0"> </span><br>
<span id="day1"> </span><br>
<span id="day2"> </span><br>
<span id="day3"> </span><br>
<span id="day4"> </span><br>
<span id="day5"> </span><br>
<span id="day6"> </span>
</p>
</td>
</tr>
</table>
</form>
</body>
</html>
--
Fred
Fred Oz wrote: netsurfer wrote: I'm going to try to make this concept easier to answer since the
above is messy code please see my "hypothetical" example and tell me how
I can get dates automatically entered in with this HTML document:
Thanks for cleaning up your code, at least a little.
[...] <INPUT TYPE=text ID=Amount1 Name=Amount1 Value="""> Date gets
All attributes should be quoted, and that extra " at the end will upset most browsers.
You only need both id and name attributes on form elements under certain circumstances, it is not needed here. Just use name. And if you aren't going to give the input a value, why include an empty value attribute? It's optional, it isn't required and just gives more code to maintain (and you've got an error...)
I also would not use input fields for the generated dates as users will likely try to modify them (unless you want your users modifying the dates).
[...] Thursday...."2/3/05" automatically fills here.</p>
Do not assume US dates. Always specify input formats and units where appropriate. Assume your users are really dumb (but don't *treat* them as dumb). Make everything obvious with subtle but concise and accurate help.
[...]
It seems you are trying to create a Hegira week - or am I way off? The code below creates a set of dates from Thu to the following Wed that includes the input date.
It does not validate the input - you need to do that. You need to check that integers within an appropriate range have been entered, I'll leave that up to you.
<html><head> <title>Date Play</title> <style type="text/css"> body {font-family: sans-serif;} .dd {text-align: center;} .od {text-align: right; border: 1px solid blue; width: 15em;} </style> <script type="text/javascript">
var months = ['January','February','March','April','May','June', 'July', 'August','September','October','November','Decembe r'];
var days = ['Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday']
function doDates(f) {
var slot; // will store a reference to the output element
// Get the input text and divide into bits var dBits = f.startDate.value.split('-');
/* Code here to validate input .... */
// If passes validation, create a date at noon on date entered var sDate = new Date(dBits[0],dBits[1]-1,dBits[2],'12');
// Go backward through week to Thursday while ( days[sDate.getDay()] != days[4]) { sDate.setDate(sDate.getDate()-1); }
// Write the days of the week to the fields for (var i=0; i<7; i++){ var dateString = days[sDate.getDay()] + ', ' + addZ(sDate.getDate()) + ' ' + months[sDate.getMonth()] + ', ' + sDate.getFullYear();
// Get the field to write to if (document.getElementById) { slot = document.getElementById('day' + i); } else if (document.all) { slot = document.all('day' + i); }
// See if slot has any child nodes. If so, remove them while (slot.firstChild) { slot.removeChild(slot.firstChild); }
// Add a text node with the date string in it slot.appendChild(document.createTextNode(dateStrin g));
// Add one day to the date sDate.setDate(+sDate.getDate()+1); } }
// Adds a leading zero to single digit numbers function addZ(x) { return (x<10)? '0'+x:x; } </script>
</head> <body>
<form action=""> <table> <tr> <td class="dd">Enter the start date<br>(yyyy-mm-dd):</td> <td class="dd"><INPUT TYPE="text" id="startDate" name="startDate" value="2005-02-09"><br> <INPUT TYPE="button" value="Set dates" onclick=" doDates(this.form); "> <input type="reset"> </td> </tr> <tr> <td class="dd">Dates:</td> <td> <p class="od"> <span id="day0"> </span><br> <span id="day1"> </span><br> <span id="day2"> </span><br> <span id="day3"> </span><br> <span id="day4"> </span><br> <span id="day5"> </span><br> <span id="day6"> </span> </p> </td> </tr> </table> </form>
</body>
</html> -- Fred
Ahhh...very cool..thanks Fred.
JRS: In article <4208acc3$0$18934$5a62ac22@per-qv1-newsreader-
01.iinet.net.au>, dated Tue, 8 Feb 2005 22:11:51, seen in
news:comp.lang.javascript, Fred Oz <oz****@iinet.net.auau> posted : netsurfer wrote: I'm going to try to make this concept easier to answer since the above is messy code please see my "hypothetical" example and tell me how I can get dates automatically entered in with this HTML document: Thanks for cleaning up your code, at least a little.
[...] <INPUT TYPE=text ID=Amount1 Name=Amount1 Value="""> Date gets
All attributes should be quoted, and that extra " at the end will upset most browsers.
Where an attribute is a pure alphanumeric identifier, then IMHO quoting
just adds to bloat, clutter, and the possibility of misquoting.
MSIE4 did not mind """; but of course W3's TIDY disliked it.
You only need both id and name attributes on form elements under certain circumstances, it is not needed here. Just use name.
Agreed - but, more importantly, different but nearby elements should
have different names/IDs. The OP had two Amount1 fields.
I also would not use input fields for the generated dates as users will likely try to modify them (unless you want your users modifying the dates).
They are, however, easy to address; and using readonly tends to
inhibit modification (what percentage of installed browsers honour
readonly?). In some contexts, they can be used to provide an indication
that the field is, or will be, calculated and is not supplied in HTML.
In this context, that is not needed.
Do not assume US dates.
It does not validate the input - you need to do that. You need to check that integers within an appropriate range have been entered, I'll leave that up to you.
You don't need to, taking that literally. Checking day-of-month in
1..31 allows Feb 30th, whereas by using a Date Object a full check of
field values can be done in a couple of lines - read the newsgroup FAQ!
var dBits = f.startDate.value.split('-');
.split(/\D+/) // more lenient : '+'?
// If passes validation, create a date at noon on date entered var sDate = new Date(dBits[0],dBits[1]-1,dBits[2],'12');
That can be done during full validation; the hours need not be a string,
and can be omitted (864e5 is not used).
// Go backward through week to Thursday while ( days[sDate.getDay()] != days[4]) { sDate.setDate(sDate.getDate()-1); }
with (sDate) setDate(getDate() - (n + getDay())%7)
should do that in one move, with n=3 for Thursday; and your array
lookups are superfluous.
// Get the field to write to if (document.getElementById) { slot = document.getElementById('day' + i); } else if (document.all) { slot = document.all('day' + i); }
// See if slot has any child nodes. If so, remove them while (slot.firstChild) { slot.removeChild(slot.firstChild); }
Are there browsers with .firstChild but not getElementById ?
sDate.setDate(+sDate.getDate()+1);
^ not needed
The OP needs to read the newsgroup FAQ, section 2.3, if he wants to
deserve assistance.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Something simple that works, and sticks close to your original post:
<html>
<head>
<script>
function fillDates(){
//set array of weekdays
var weekday=new
Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday")
//capture the entered date
enterDate = document.dateStuff.Amount0.value;
// DO SOME ERROR HANDLING HERE CHECK FOR VALID DATE (MM/DD/YY) !!!!!
//split date into individual pieces
var dateArray = enterDate.split('/')
//translate the string '05' to '2005'
dateArray[2] = "20"+dateArray[2]
//assemble date object
sdate = new Date(dateArray[2],dateArray[0]-1,dateArray[1])
//work backwards through date fields
for (i = 7; i >= 1; i--){
//assemble date
newDate = weekday[sdate.getDay()] + " " + ((sdate.getMonth()+1) +
"/" + sdate.getDate() + "/" +
sdate.getFullYear().toString().substring(2,4))
//write date
eval("document.dateStuff.Amount" + i + ".value = newDate")
//go back one day
sdate = new Date(sdate.getTime() - 86400000);
}
}
</script>
</head>
<body>
<form name="dateStuff">
<p><INPUT TYPE=text ID=Amount0 Name=Amount0 Value="">
<a href="#" onClick="fillDates()">Enter</a>
Date gets entered here. Example user enters
"2/9/05"</p>
<p><INPUT TYPE=text ID=Amount1 Name=Amount1 Value="">
Thursday...."2/3/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount2 Name=Amount2 Value="">
Friday....."2/4/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount3 Name=Amount3 Value="">
Saturday...."2/5/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount4 Name=Amount4 Value="">
Sunday...."2/6/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount5 Name=Amount5 Value="">
Monday..."2/7/05" automatically fills here.</p>
<p><INPUT TYPE=text ID=Amount6 Name=Amount6 Value="">
Tuesday...."2/8/05" automatically fills in here.</p>
<p><INPUT TYPE=text ID=Amount7 Name=Amount7 Value="">
Wednesday......"2/9/05" automatically fills in here.</p>
</form>
</body>
</html>
Dr John Stockton wrote:
[...] All attributes should be quoted, and that extra " at the end will upset most browsers.
Where an attribute is a pure alphanumeric identifier, then IMHO quoting just adds to bloat, clutter, and the possibility of misquoting.
The operative word being "should", not must. The w3c HTML 4.01
spec says:
3.2.2 Attributes
Elements may have associated properties, called attributes,
which may have values...
By default, SGML requires that all attribute values be
delimited using either double quotation marks (ASCII decimal
34) or single quotation marks (ASCII decimal 39).
...
In certain cases, authors may specify the value of an
attribute without any quotation marks. The attribute value may
only contain letters (a-z and A-Z), digits (0-9), hyphens
(ASCII decimal 45), periods (ASCII decimal 46), underscores
(ASCII decimal 95), and colons (ASCII decimal 58). We
recommend using quotation marks even when it is possible to
eliminate them.
<URL:http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2>
AFAIK, every example in the HTML 4.01 spec uses quoted attribute
values - so whilst it isn't required, I think it's a good idea. MSIE4 did not mind """; but of course W3's TIDY disliked it.
Contrary to my post, most browsers probably will tolerate it,
but it sure messed with my text editor's syntax colouring!
[...] It does not validate the input - you need to do that. You need to check that integers within an appropriate range have been entered, I'll leave that up to you.
You don't need to, taking that literally. Checking day-of-month in 1..31 allows Feb 30th, whereas by using a Date Object a full check of field values can be done in a couple of lines - read the newsgroup FAQ!
I was thinking more along the lines of dates permitted within
the OP's application logic - say within one month of today. I
should have said 'dates', not 'integers' ... my bad. var dBits = f.startDate.value.split('-');
.split(/\D+/) // more lenient : '+'?
Yes, great idea - allows and delimiter. But what to use for
on-screen help?
[...] // Get the field to write to if (document.getElementById) { slot = document.getElementById('day' + i); } else if (document.all) { slot = document.all('day' + i); }
// See if slot has any child nodes. If so, remove them while (slot.firstChild) { slot.removeChild(slot.firstChild); }
Are there browsers with .firstChild but not getElementById ?
Point taken, but the other choices were:
- put the same "while" on both sides of the else (ugh, bloat)
- use a DynWrite type solution - seems over the top for this
- add:
} else {
alert('Your browser ain\'t supported by this script');
return false;
}
Incidentally, I used firstChild rather than childNodes 'cos
Safari doesn't support access to the childNodes collection,
even though (eleRef.childNodes) may return true. sDate.setDate(+sDate.getDate()+1);
^ not needed
The "+" is not needed to ensure the "1" is added rather than
appended, but to my mind it improves readability.
--
Fred
JRS: In article <11**********************@c13g2000cwb.googlegroups .com>
, dated Tue, 8 Feb 2005 16:37:38, seen in news:comp.lang.javascript, pj************@gmail.com posted : Something simple that works, and sticks close to your original post:
You have posted your article as a follow-up to mine, yet yours is
unrelated to mine. You have not given proper quoting or attribution.
You have allowed your posting agent to wrap code lines. Please find out
how to post correctly.
//write date eval("document.dateStuff.Amount" + i + ".value = newDate")
Routine eval is a bad idea for this. Read the newsgroup FAQ.
//go back one day sdate = new Date(sdate.getTime() - 86400000);
Naive. Though (the page is obviously suited only to Murricans, as it
has FFF dates) it will suffice for users in much of Arizona, in Hawaii,
and in most of southern Indiana; and in non-contiguous territories
(American Samoa, Guam, Puerto Rico, the Virgin Islands).
Test it over the first Sunday on April, if you are in the rest of the
USA; the last one of March, if in the EU; about six months later, if
Antipodean (not Que, NT, WA, though).
Discover the difference between Date and Time.
Read the newsgroup FAQ.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: paul b |
last post by:
Hello,
I have a small problem in PHP an perhaps someone can help me:
I have a simple HTML login page with a username and a password field,
as well as a submit button, which I have to use for...
|
by: Sparrow |
last post by:
I have created a table with the following columns...
Date(datetime),Actual (Int),Planned (Int)
I need to insert weekending dates starting from 23/04/04 looping
thru'for the next 52weeks...
|
by: Arthur Shapiro |
last post by:
I'm the webmaster for a recreational organization. As part of one page of the
site, I have an HTML "Calendar at a Glance" of the organization's events for
the month. It's a simple table of a...
|
by: SJH |
last post by:
I currently have reports (mostly graphs) that utilize dates entered into a
form. The dates are pretty baisc from the standpoint of the start and end
of the current fiscal year, the start and end...
|
by: Johann Blake |
last post by:
I have a dataset that contains a parent table and a child table. A
DataRelation exists between the two. I was under the impression from
reading the VS docs that when I filled the parent table, the...
| |
by: neoteny2 |
last post by:
I need MS Access to automatically create reports/subreports based on
specific criteria. I am building a database in Access 2003 with
different locations/sites. I have the "sites" table created...
|
by: RoadRunner |
last post by:
Hi, I have a employee vacation database that has a vacation table that
has the employee name, pay week and date of vacation. I have another
lookup table with pay week code and date range for the...
|
by: sunboy30860 |
last post by:
How to update my web automatically by python?
I have one twiki web page
https://twiki.cern.ch/twiki/bin/view/Atlas/CSC11DQ2ReplicateToCERNCAF
In this page,the dates often need to be...
|
by: John |
last post by:
I made an Access application that helps with the financial administration of
a company. It imports downloaded files from a bank. For the download the
user has to enter the start and end date on a...
|
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,...
|
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: 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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |