469,356 Members | 1,938 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Putting date in the text box


What I am trying to do is when the user clicks on the date th
month/date/year appears in the text box like this: 1/15/2004. Ho
would I do this. This is not home work, but it is for a client o
mine.
Calendar Code:
<html>
<head>
<style>
.cw {width:20px}
.jan{
position:absolute;
font-family:comic sans ms;
width: 147px;
height: 21px;
text-align:center;
left: -1px;
top: 4px;
}
.date{
position:absolute;
font-family:comic sans ms;
left: 1px;
top: 38px;
width: 143px;
height: 10px;
}
.close{
text-align:center;
}

</style>
<script>
function a() {
document.getElementById('show_cal').style.visibili ty = 'visible';
}
</script>
</head>
<body>

<input type="text" name="txtDate">

<input name="button" type="button" onClick="a()" value="Calendar">
<div id ="show_cal" style="position: absolute; top: 52px; left:162px
border: solid; visibility:hidden; width: 151px; height: 198px;">
<br><br>
<table class="jan" border="1">
<tr>
<td>January</td>
</tr>
</table>
<table width="145" border="0" class="date">
<tr>
<td>s</td>
<td>m</td>
<td>t</td>
<td>w</td>
<td>r</td>
<td>f</td>
<td>s</td>
</tr>
</table>
<br><br>
<script>

ms = 5;
dm = 31;
d = 1;

for (i=1; i<=42;i++){

if ( i >= ms && d <=dm)
{
html ="<input type='text' class='cw' value=" + d + ">";
d++;
}
else
{
html = "<input type='text' class='cw'>";
}
document.write(html);

if (i % 7 == 0){
document.write("<br>");
}

}

</script>
<a class="close" href="#
onclick="parentNode.style.visibility='hidden';"><c enter>Close</center></a>
</div>

</body>
</html

newtd
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message33119.htm

Jul 20 '05 #1
1 1119
Lee
newtda said:


What I am trying to do is when the user clicks on the date the
month/date/year appears in the text box like this: 1/15/2004. How
would I do this. This is not home work, but it is for a client of
mine.


If this really isn't homework, you should consider taking a class
before taking on any more clients.

Google for "popup calendar javascript" and you'll probably find
several date pickers to choose from.

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Toby A Inkster | last post: by
9 posts views Thread by Shaiboy_UK | last post: by
3 posts views Thread by Patrick | last post: by
3 posts views Thread by Ivan V via DotNetMonster.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.