Forum Moderators: coopster & phranque

Message Too Old, No Replies

Javascript:

more than one variable into a variable

         

grnidone

6:58 pm on Apr 15, 2001 (gmt 0)



I know you all will find this a very simple task. However, I am about to tear my hair out trying to figure it out.

This is what I want to do.

Let's write a date:

month day year
April 15 2001

I can document.write the date, however, I have three parts to the document.write:

document.write(monthNames[month] + " " + date + ", " + year);

Now, I want to put that whole mess into a variable like this however I don't know how to do it:

var alldate = _______

So that, I can do this:

document.write(alldate);

and the result will be:
April 15 2001

This is probably very simple for all of you, but I can't figure it out.

Thanks,
-G

PS I just noticed that I put it in the wrong forum..*sigh*

tedster

9:05 pm on Apr 15, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



var alldate = monthNames[month] + " " + date + ", " + year

Date handling can be trickier than it seems on the surface, but I think that should do it.

If it doesn't, I'd first make sure that the variables (month, date, year) and the array monthNames[] are all properly defined in the previous code.