Putting date in the text box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • newtda

    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:absolu te;
    font-family:comic sans ms;
    width: 147px;
    height: 21px;
    text-align:center;
    left: -1px;
    top: 4px;
    }
    .date{
    position:absolu te;
    font-family:comic sans ms;
    left: 1px;
    top: 38px;
    width: 143px;
    height: 10px;
    }
    .close{
    text-align:center;
    }

    </style>
    <script>
    function a() {
    document.getEle mentById('show_ cal').style.vis ibility = '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:hidd en; 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="parent Node.style.visi bility='hidden' ;"><center>Clos e</center></a>
    </div>

    </body>
    </html

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

  • Lee

    #2
    Re: Putting date in the text box

    newtda said:[color=blue]
    >
    >
    >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.[/color]

    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.

    Comment

    Working...