Javascript可以这样实现:<script language="javascript">
function getMonLength(theYear,theMonth){
var oneDay = 1000 * 60 * 60 * 24;
var thisMonth = new Date(theYear, theMonth-1, 1);
var nextMonth = new Date(theYear, theMonth, 1);
var len = Math.ceil((nextMonth.getTime() - thisMonth.getTime())/oneDay);
return len;
}
document.write(getMonLength(2004,11));
</script>
function getMonLength(theYear,theMonth){
var oneDay = 1000 * 60 * 60 * 24;
var thisMonth = new Date(theYear, theMonth-1, 1);
var nextMonth = new Date(theYear, theMonth, 1);
var len = Math.ceil((nextMonth.getTime() - thisMonth.getTime())/oneDay);
return len;
}
document.write(getMonLength(2004,11));
</script>
解决方案 »
- 请问如何用php解析js的eval代码字符串
- PHP 读取TXT文本问题
- php如何实现类似ecshop中的产品对比功能
- 请教php如何实现传输二进制字节流到MTK客户端程序
- 优秀程序能否进来帮优化一下这几个错误语句....
- 我有个网站要跟网吧合作,将网吧主页设置为我的网站,但我不知道该如何检测网吧内的所有机子是否主页还是我的网站
- 这样的xml如何按条件删除记录 或排序?
- 这句正确得如何写啊?总是出错
- php+xml xsltll xdomxml.dll 架不起来,
- 配置apache+php 出错(急急急)
- 这有一个协同办公系统,大家登陆后可在系统意见箱提点意见
- 求一PHP正则表达式,十万火急
www.adr.gov.cn/download/ccc.htm
<select name="year" onchange=selectyear()>
for($i=1;$1<9999;$i++>
<option value=<?=$i?>><?echo $i;?><option>
</select><select name="month" onchange=selectmont()>
for($i=1;$1<13;$i++>
<option value=<?=$i?>><?echo $i;?><option>
</select><srcipt language="javascript">
founction selectyear(){
var year=document.form1.year.value;
}founction selectmonth(){
var month=document.form1.month.value;
}function submit(){
location.href="<?=$PHP_SELF?>?year="+year+"&month="+month;
}
</script>
</form1>
<?echo $month;
echo $day;$mothday=$month.$day;
?>
<form name=from1 onsumbit=submit()>
<select name="day" onchange=selectday()>
for($i=1;$1<30;$i++>
<option value=<?=$i?>><?echo $i;?><option>
</select><select name="month" onchange=selectmont()>
for($i=1;$1<13;$i++>
<option value=<?=$i?>><?echo $i;?><option>
</select><srcipt language="javascript">
founction selectyear(){
var year=document.form1.year.value;
}founction selectmonth(){
var month=document.form1.month.value;
}function submit(){
location.href="<?=$PHP_SELF?>?day="+day+"&month="+month;
}
</script>
</form1>
<?echo $month;
echo $year;switch($month){
case "1" :
case "3":
case "5":
case "7":
case "8":
case "10":
case "12":
$day=31;
break;
case "2": if($year%4==0&&$year%100!=0)//润年
{ $day=29; }
else $day=28;
break;
case "4":
case "6";
case "9":
cse "11":
$day=30;
break;
}
echo $day;
?>
<form name=from1 onsumbit=submit()>
<select name="year" onchange=selectyear()>
for($i=1;$1<9999;$i++>
<option value=<?=$i?>><?echo $i;?><option>
</select><select name="month" onchange=selectmont()>
for($i=1;$1<13;$i++>
<option value=<?=$i?>><?echo $i;?><option>
</select><srcipt language="javascript">
founction selectyear(){
var year=document.form1.year.value;
}founction selectmonth(){
var month=document.form1.month.value;
}function submit(){
location.href="<?=$PHP_SELF?>?year="+year+"&month="+month;
}
</script>
</form1>