SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    There can be only One.... joelwills's Avatar
    Join Date
    Jul 2000
    Location
    England
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trying to Input Date into a form

    Hi,

    I have a simple ASP guestbook, and I am trying to get the date to input along with the text. However, I cannot get the javascript (which I use to get the date) into the form to enable it to be submitted. The code is:


    <TD ALIGN="left"><B>Name/B></TD>
    <TD><INPUT TYPE="text" NAME="name" SIZE="15"></INPUT></TD>
    </TR>
    <TR>
    <TD ALIGN="left"><B>Comment/B></TD>
    <TD><INPUT TYPE="text" NAME="comment" SIZE="60"></INPUT></TD>
    </TR>
    <TR>
    <TD ALIGN="left"><B>Date/B></TD>
    <TD><INPUT TYPE="text" NAME="date" SIZE="10>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    Stamp = new Date();
    document.write('<font size="2" face="Arial"><B>' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getYear() + '</B></font> ');
    var Hours;
    var Mins;
    var Time;
    Hours = Stamp.getHours();
    if (Hours >= 12) {
    Time = " P.M.";
    }
    else {
    Time = " A.M.";
    }

    if (Hours > 12) {
    Hours -= 12;
    }

    if (Hours == 0) {
    Hours = 12;
    }

    Mins = Stamp.getMinutes();

    if (Mins < 10) {
    Mins = "0" + Mins;
    }

    document.write('<font size="2" face="Arial"><B>' + Hours + ":" + Mins + Time + '</B></font>');

    //-->
    </SCRIPT></INPUT>
    </TD>
    </TR>
    </TABLE>
    The final date part is the bit I'm having problems with. In it's current state the time appears after the input box. I know this is not the correct wat, I just need another way to submit the date (currently using
    objFile.Write Server.HTMLEncode(Request.Form("name"))
    ). If you need the entire ASP code, then please ask!

    Many thanks,

    Joel
    Life Goggles - The Entertaining Environment Blog
    http://www.lifegoggles.com

  2. #2
    grasshoppa Snowbird122's Avatar
    Join Date
    Apr 2001
    Location
    Austin
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why not just use ASP to put the date in for you?

    Code:
    <TD ALIGN="left"><B>Name:</B></TD> 
    <TD><INPUT TYPE="text" NAME="name" SIZE="15"></INPUT></TD> 
    </TR> 
    <TR> 
    <TD ALIGN="left"><B>Comment:</B></TD> 
    <TD><INPUT TYPE="text" NAME="comment" SIZE="60"></INPUT></TD> 
    </TR> 
    <TR> 
    <TD ALIGN="left"><B>Date:</B></TD> 
    <TD><INPUT TYPE="text" NAME="date" SIZE="10" 
    value="<%=now%>"></INPUT> 
    </TD> 
    </TR> 
    </TABLE>
    http://www.echo-consulting.net - Sound Solutions for Online Inspriations.

  3. #3
    There can be only One.... joelwills's Avatar
    Join Date
    Jul 2000
    Location
    England
    Posts
    201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds good to me, and much simplier!

    Many thanks for your help
    Life Goggles - The Entertaining Environment Blog
    http://www.lifegoggles.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •