function date()
{
var start=new Date("2010/8/1");
var end = new Date("2010/8/10");
var allDay = parseInt(end - start) / (24 * 60 * 60 * 1000) + 1;
var weekday = 0;
for (var i = 1; i < allDay+1; i++) {
var time = new Date(start.getYear(), start.getMonth(), start.getDate() + i);
if (time.getDay() == 0 || time.getDay() == 6) {
weekday++;
}
alert(time.getYear()+'-'+time.getMonth()+'-'+time.getDate());
}
alert(allDay); //10
alert(weekday); //3
alert(allDay-weekday); //7
}