<input name="months" >
<input name="button1" value="按" onclick=show() type="button">
<textarea id="result" style="width:200;height:200"></textarea>
<script language=javascript>
function show()
{
var str=document.getElementById("months").value
re=/^\d{4}\d{2}$/
if(!re.test(str)){
alert("输入错误")
}
var strYear=str.substr(0,4)
var strMonth=parseInt(str.substr(4,2),10)
if((strMonth<1)||(strMonth>12)){
alert("输入错误")
}
Date.prototype.todateString=function(){
strMonth=parseInt(this.getMonth())+parseInt(1);
strMonth=strMonth.toString()
return this.getYear().toString()+((strMonth.length==1)?("0"+strMonth):strMonth)+((this.getDate().toString().length==1)?("0"+this.getDate().toString()):this.getDate().toString())
}
var tempDate=new Date(strYear,strMonth-1,1);
var result=new Array();
while(tempDate.getMonth()==(strMonth-1)){
result[result.length]=new Array(tempDate.todateString(),tempDate.getDay());
tempDate=new Date((tempDate/1000+86400)*1000)
}
document.getElementById("result").value=result.join("\n")
}
</script>
<input name="button1" value="按" onclick=show() type="button">
<textarea id="result" style="width:200;height:200"></textarea>
<script language=javascript>
function show()
{
var str=document.getElementById("months").value
re=/^\d{4}\d{2}$/
if(!re.test(str)){
alert("输入错误")
}
var strYear=str.substr(0,4)
var strMonth=parseInt(str.substr(4,2),10)
if((strMonth<1)||(strMonth>12)){
alert("输入错误")
}
Date.prototype.todateString=function(){
strMonth=parseInt(this.getMonth())+parseInt(1);
strMonth=strMonth.toString()
return this.getYear().toString()+((strMonth.length==1)?("0"+strMonth):strMonth)+((this.getDate().toString().length==1)?("0"+this.getDate().toString()):this.getDate().toString())
}
var tempDate=new Date(strYear,strMonth-1,1);
var result=new Array();
while(tempDate.getMonth()==(strMonth-1)){
result[result.length]=new Array(tempDate.todateString(),tempDate.getDay());
tempDate=new Date((tempDate/1000+86400)*1000)
}
document.getElementById("result").value=result.join("\n")
}
</script>
<input name="months" >
<input name="button1" value="按" onclick=show() type="button">
<textarea id="result" style="width:200;height:200"></textarea>
<script language=javascript>
function show()
{
var strDay="日一二三四五六"
var str=document.getElementById("months").value
re=/^\d{4}\d{2}$/
if(!re.test(str)){
alert("输入错误")
}
var strYear=str.substr(0,4)
var strMonth=parseInt(str.substr(4,2),10)
if((strMonth<1)||(strMonth>12)){
alert("输入错误")
}
Date.prototype.todateString=function(){
strMonth=parseInt(this.getMonth())+parseInt(1);
strMonth=strMonth.toString()
return this.getYear().toString()+((strMonth.length==1)?("0"+strMonth):strMonth)+((this.getDate().toString().length==1)?("0"+this.getDate().toString()):this.getDate().toString())
}
var tempDate=new Date(strYear,strMonth-1,1);
var result=new Array();
while(tempDate.getMonth()==(strMonth-1)){
result[result.length]=new Array(tempDate.todateString(),"星期"+strDay.charAt(tempDate.getDay()));
tempDate=new Date((tempDate/1000+86400)*1000)
}
document.getElementById("result").value=result.join("\n")
}
</script>