/    Sign up×
Community /Pin to ProfileBookmark

Javascript date picker

[B]code for Javascript date picker.[/B]
date-picker.html is another file

When i select start date or end date.it is displaying in same text field.
How to resolve the problem

[U]date.php[/U]
<html>
<head>
<script type=”text/javascript”>
<!–
function SelectDate()
{
D = document.getElementById(‘Date’).value;
if(D){
D = D.split(‘/’);
}else{
Dat = new Date();
D = new Array(Dat.getDay(), Dat.getMonth(), Dat.getFullYear());
}
win = window.open(“date-picker.html”,”win”,”status=no,scrollbars=no,toolbar=no,menubar=no,height=150,width=150″);
if (parseInt(navigator.appVersion) == 2 && navigator.appName == “Netscape”)
win = window.open(“date-picker.html”,”win”,”status=yes,height=325,width=250″);
//win’MakeDate’,D[2], D[1],D[0], ‘SetDate’);
win.MakeDate(D[2], D[1], D[0]);
}
function SetDate(Day, Month, Year)
{
document.getElementById(‘Date’).value = Year + ‘-‘ + Month + ‘-‘ + Day;
}
–>
</script>

<script type=”text/javascript”>
<!–
function SelectDate2()
{
D = document.getElementById(‘d’).value;
if(D){
D = D.split(‘/’);
}else{
Dat = new Date();
D = new Array(Dat.getDay(), Dat.getMonth(), Dat.getFullYear());
}
win = window.open(“date-picker.html”,”win”,”status=no,scrollbars=no,toolbar=no,menubar=no,height=150,width=150″);
if (parseInt(navigator.appVersion) == 2 && navigator.appName == “Netscape”)
win = window.open(“date-picker.html”,”win”,”status=yes,height=325,width=250″);
//win’MakeDate’,D[2], D[1],D[0], ‘SetDate’);
win.MakeDate(D[2], D[1], D[0]);
}
function SetDate(Day, Month, Year)
{
document.getElementById(‘d’).value = Year + ‘-‘ + Month + ‘-‘ + Day;
}
s–>
</script>

</head>

<body>

<input type=”text” name=”Date” id=”Date” readonly />
<input type=”button” onClick=”SelectDate(‘Date1’)” value=”start date”><br>

<input type=”text” name=”d” id=”d” readonly />
<input type=”button” onClick=”SelectDate2(‘Date1’)” value=”End date”><br>

</body>
</html>

can any one point out the mistake

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @nithi_30 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.19,
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,
)...