Script Categories













Calendars >>> Day counter.

Tells you many wednesdays (or any other day) there are in the current month. It can be modified to work with any day of the week, or all of them!

Add the below code to the <body> section of your page:

<center>
<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Original:  Michael Mann (pres@manninc.com) -->
<!-- Web Site:  http://www.manninc.com -->
<!-- Begin
var now = new Date();
var month = now.getMonth();
var date = now.getDate();
var day = now.getDay();
var year = now.getYear();
m = new Array("January","February","March","April","May","June","July",
"August","September","October","November","Decemeber");
d = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
if (year < 2000) year = year + 1900;
//End of Month Calculations
var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
// check for leap year
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monarr[1] = "29";
//Finds the First Day for the Current Month
while (date != 1){
date = date - 1;
day = day - 1;
if (day < 0) day = day + 7;
}
//Counts Number of Wednesdays in the Current Month
weekday = 0;
while (date != monarr[month]){
date = date + 1;
day = day + 1;
if (day > 6)
day = 7 - day;
if (d[day] == "Wednesday")
weekday = weekday + 1;
}
//Fix For Months beginning on a Wednesday
if (d[day] == "Wednesday") weekday = weekday + 1;
document.write ("<b>"+m[month] + " contains " + weekday + " " + d[3] + "s</b>");//  End -->
</script>
</center>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©