lse123
12-28-2005, 04:16 PM
http://javascriptkit.com/script/script2/curdateform2.shtml
For the date script at above url, what if I want two or more date fields in the same form[same page] showing ALL CURRENT DATE , what to do ?
just like that:
what if I want two or more date fields in the same form[same page] showing ALL CURRENT DATE , what to do ?
What if? :D
What is your aim, after all?
Nischumacher
12-28-2005, 04:40 PM
<body onload="SetToToday('FirstSelect'); SetToToday('SecondSelect');">
name the new drop down as 'SecondSelectDay', 'SecondSelectMonth', 'SecondSelectYear'...
and change the onchange call for each drop down...
<SELECT name="SecondSelectMonth" onchange="ChangeOptionDays('SecondSelect')">
do the same for third, fourth, fifth date fields...
Pyth007
12-30-2005, 08:47 PM
Similarly to Nischumacher's solution, except that a number is used inside the name instead of 'first', 'second', etc. This allows a loop to be used...
<script type="text/javascript">
function setDateFields()
{
for(var index=0; index<5; index++) // Assuming you have 5 sets of date lists
{
SetToToday('Select'+index);
}
}
function setToToday(dateField)
{
// Enter your code from site here...
}
window.onload=setDateFields;
</script>
There's just a few changes that you would need to be aware of doing it this way....
Variable names cannot begin with numbers; hense I started the names with 'Select' and added the numbers to the second position. Thus the drop-down lists get named: 'Select1Day', 'Select1Month', and 'Select1Year' respectively.
Because of the new naming styles, the onchange would get changed to:
onchange="ChangeOptionDays('Select1')"
I've also put the page's onload inside the <script> tags (which you could place inside the <head> of your page). Thus you won't call onload="..." inside the <body>.
lse123
01-06-2006, 05:06 PM
http://www.frontpagewebmaster.com/fb.asp?m=306965
Please review the forum answer to above url and answer:
I do this but,
in frontpage "Preview Mode" appears good(date current for both) but when publish it to www the date is not current for both date fields but 01 jan 2006 ?
----------------------
also another problem: after pressing "submit" form a "FrontPage Error." appears, well, please test it and view source code at :
http://polis-index.com.cy/test-sd/two-date-fields.htm
mark87
01-06-2006, 05:09 PM
Can't you populate the other from the values of the first one?
lse123
01-06-2006, 05:24 PM
what you mean , please say it more describetive ?
lse123
01-06-2006, 05:26 PM
please say it in more detail
Ancora
01-06-2006, 05:29 PM
<html>
<head>
<script type="text/javascript">
window.onload=function(){
var defaultDate = new Date();
var todayStr =
defaultDate.getMonth()+1+"/"+defaultDate.getDate()+"/"+defaultDate.getFullYear();
document.forms[0].isToday1.value = todayStr;
document.forms[0].isToday2.value = todayStr;
document.forms[0].isToday3.value = todayStr;
}
</script>
</head>
<body>
<form name='anyName'>
Today is: <input type=text size=9 name='isToday1' readonly><br>
Today is: <input type=text size=9 name='isToday2' readonly><br>
Today is: <input type=text size=9 name='isToday3' readonly><br>
</form>
</body>
</html>