/    Sign up×
Community /Pin to ProfileBookmark

Date Selector

I am trying to integrate the calendar selector coding into my aspx
coding. It was working fine until i wanted to have different names for
each set of calendar selector as i needed more than 1 set of year, month and day. I would not want all of them to have the same names.

However, it wont seem to work.
Below is the coding that i have done. It will be great if anyone can help me out here. Thank you

[code=html]<td>
<SCRIPT>fill_select(document.frmData,”PurchaseMth”,”PurchaseDay”,”PurchaseYear”);year_install(document.frmData,”PurchaseDay”,”PurchaseMth”,”PurchaseYear”)</SCRIPT>
</td>
[/code]

[Code]
<SCRIPT>

var date_arr = new Array;

var days_arr = new Array;

date_arr[0]=new Option(“January”,31);

date_arr[1]=new Option(“February”,28);

date_arr[2]=new Option(“March”,31);

date_arr[3]=new Option(“April”,30);

date_arr[4]=new Option(“May”,31);

date_arr[5]=new Option(“June”,30);

date_arr[6]=new Option(“July”,31);

date_arr[7]=new Option(“August”,30);

date_arr[8]=new Option(“September”,30);

date_arr[9]=new Option(“October”,31);

date_arr[10]=new Option(“November”,31);

date_arr[11]=new Option(“December”,30);

function fill_select(f,objMth,objDay,objYear)

{

document.writeln(“<SELECT name=””+objMth+””
onchange=”update_days(frmData,,objDay,objMth,objYear)”>”);

for(x=0;x<12;x++)

document.writeln(“<OPTION
value=””+date_arr[x].value+””>”+date_arr[x].text);

document.writeln(“</SELECT><SELECT name=””+objDay+””></SELECT>”);

selection=f.objMth[f.objMth.selectedIndex].value;

}

function update_days(f,objDay,objMth,objYear)

{
temp=f.objDay.selectedIndex;

for(x=days_arr.length;x>0;x–)

{

days_arr[x]=null;

f.objDay.options[x]=null;

}

selection=parseInt(f.objMth[f.objMth.selectedIndex].value);

ret_val = 0;

if(f.objMth[f.objMth.selectedIndex].value == 28)

{

year=parseInt(f.objYear.options[f.objYear.selectedIndex].value);

if (year % 4 != 0 || year % 100 == 0 ) ret_val=0;

else

if (year % 400 == 0) ret_val=1;

else

ret_val=1;

}

selection = selection + ret_val;

for(x=1;x < selection+1;x++)

{

days_arr[x-1]=new Option(x);

f.objDay.options[x-1]=days_arr[x-1];

}

if (temp == -1) f.objDay.options[0].selected=true;

else

f.objDay.options[temp].selected=true;

}

function year_install(f,objDay,objMth,objYear)

{

document.writeln(“<SELECT name=””+name+””
onchange=”update_days(frmData,objDay,objMth,objYear)”>”)

for(x=2005;x<2010;x++) document.writeln(“<OPTION value=””+x+””>”+x);

document.writeln(“</SELECT>”);

update_days(f,objDay,objMth,objYear)

}

</SCRIPT>
[/Code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Jonny_LangAug 23.2005 — Code deleted.


[URL=http://www.webdeveloper.com/forum/showthread.php?p=422859#post422859post422859]Read This[/URL]
Copy linkTweet thisAlerts:
@shaoen01authorAug 24.2005 — The coding works fine except that i need multiple sets of month,date and year. And the coding does not allow me to apply this all to all of my listboxes. You know what i mean? I will like to able to rename all of the listboxes and yet get it working. Is there anyway you can do this?
×

Success!

Help @shaoen01 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...