-
Javascript problem.
How do I get the months of the year like this:
jan
feb
mar
instead of like this:
jan, feb, mar
Thanks.
-
 Originally Posted by Henrygruby
How do I get the months of the year like this:
jan
feb
mar
instead of like this:
jan, feb, mar
Thanks.
var dayArray = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
var weekBeginning = '12 July 2010'
var distanceArray = ["2", "4", "2", "1", "5", "4", "3"];
var weekBeginning = '19 July 2010'
var str = ["2", "6", "3", "1", "6", "4", "2"];
document.write("<h1>This is a heading</h1>");
document.write("<br />");
for (i = 0; i <= -1; i++)
for (j = 0; j <= -1; j++)
{
dayArray[i] = i;
distanceArray[j] = j;
}
document.write(dayArray);
document.write("<br />");
document.write(distanceArray);
-
Code:
document.write(dayArray.toString().replace(/,\s*/g, '<br>'));
Of course if you're going to want to document.write something after each day, then that's a different matter.
Q: I found this code...
A: Then find its author.
-
 Originally Posted by clueful
Code:
document.write(dayArray.toString().replace(/,\s*/g, '<br>'));
Of course if you're going to want to document.write something after each day, then that's a different matter.
Thanks mate, it works.
Could you briefly explain what this piece exactly does?
/,\s*/g,
Thanks.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks