what about new Date() ?
check this out:
http://www.mattkruse.com/j
http://www.mattkruse.com/j
Nushi.
Main Topics
Browse All TopicsHi
I am trying to reuse a function which creates todays date to output it onto my page. But nothing is happening. Can you tell me how I can access the variable 'theDate' once it holds's today's date, from my html page please? Thanks alot!
HTML:
<div id="date"><script>document
**************************
Javascript:
<!--
/***DATE FUNCTIONS***/
dayNames = new Array('Sun','Mon','Tue','W
monthNames = new Array('January','February'
var theDate = "";
var _d = new Date();
window.onload=function(){
createDateSelect();
}
//format date into weekday, day, month
function formatDate(_d)
{
var dayname = dayNames[_d.getDay()]
var daynumber = _d.getDate();
var month = monthNames[_d.getMonth()]
theDate = dayname + " " + daynumber + " " + month;
}
/*This is a large function which builds a select box of lots of dates from today onwards*/
function createDateSelect(){
_d = new Date();
formatDate(_d);
etc...
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
what about new Date() ?
check this out:
http://www.mattkruse.com/j
http://www.mattkruse.com/j
Nushi.
Business Accounts
Answer for Membership
by: Lady_MPosted on 2007-02-28 at 06:27:43ID: 18625129
Sorry, I didn't word that very well.
I mean I want to output 'theDate' into my HTML page.
I don't want to create a separate function to do it as I already have this variable being used for creating my select box. But I'm not sure how to retrieve it at the appropriate point so that it holds the right value for today. Thanks again.