defualt date in JS

K

Kevin Song

could you show me how to do defualt date in JS?

I'm asp guy I can do it in asp
asp
<%
today = now()
%>
<input type="text" name="today" value="<%=today%>>

Thanks
-Jay
 
P

Phil Leggetter

could you show me how to do defualt date in JS?

I'm asp guy I can do it in asp
asp
<%
today = now()
%>
<input type="text" name="today" value="<%=today%>>

Thanks
-Jay

To create a new date in JavaScript you create a new Date Object. You
can then manipulate the Date object as needed to create a date string
that you want as your text box value. Below is your example completed
but you will probably want the date in a different format.

oDate = new Date();
<%
var oToday = now()
%>
<input type="text" name="today" value="<%=oToday.toString()%>>

Here is a reasonably good reference:
http://developer.netscape.com/viewsource/goodman_dateobject.html


P.Leggetter
www.leggsonline.co.uk
 
J

Jay

Thanks a lot!

Phil Leggetter said:
To create a new date in JavaScript you create a new Date Object. You
can then manipulate the Date object as needed to create a date string
that you want as your text box value. Below is your example completed
but you will probably want the date in a different format.

oDate = new Date();
<%
var oToday = now()
%>
<input type="text" name="today" value="<%=oToday.toString()%>>

Here is a reasonably good reference:
http://developer.netscape.com/viewsource/goodman_dateobject.html


P.Leggetter
www.leggsonline.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top