複製代碼 代碼如下:<script type="text/javascript">
function initArray(){
this.length=initArray.arguments.length;
for(var i=0;i<this.length;i++){
this[i]=initArray.arguments[i];
}
}
var strA="";
function TimeList()
{
var i=0;
var str=new Array("零","壹","貳","三","肆","伍","陸","妻","捌","玖");
var str2=new Array("一","二","三","四","五","六","七","八","九","十");
var str3=new Array("星期天","星期一","星期二","星期三","星期四","星期五","星期六");
var time=new Date();
var year=new initArray(time.getFullYear().toString().split("")[0],time.getFullYear().toString().split("")[1],time.getFullYear().toString().split("")[2],time.getFullYear().toString().split("")[3]);
//var year=eval(time.getFullYear().toString());
var month;
if(time.getMonth().toString().length>1)
{
month=new initArray(time.getMonth().toString().split("")[0],time.getMonth().toString().split("")[1]);
}
else
{
month=new initArray(time.getMonth().toString().split("")[0]);
}
var len=year.length;
for(i=0;i<4;i++) //年
{
var k=parseInt(year[i]);
strA+=str[k];
}
strA+="年";
var j=0;
var strB="";
if(month.length>1)
{
strB+=str2[9];
strB+=str2[parseInt(time.getMonth().toString().split("")[1])];
}
else
{
strB+=str2[parseInt(time.getMonth().toString().split("")[0])];
}
strA+=strB;
strA+="月";
var strD="";
if(time.getDate().toString().length>1)
{
if(parseInt(time.getDate().toString().split("")[0])>1)
{
strD+=str2[parseInt(time.getDate().toString().split("")[0])-1];
strD+=str2[9];
if(parseInt(time.getDate().toString().split("")[1])>0)
{
strD+=str2[parseInt(time.getDate().toString().split("")[1])-1];
}
else
{
strD+="";
}
}
else
{
if(parseInt(time.getDate().toString().split("")[1])==0)
{
strD+="初";
strD+=str2[9];
}
else
{
strD+=str2[9];
strD+=str2[parseInt(time.getDate().toString().split("")[1])-1];
}
}
}
else
{
strD+="初";
strD+=str2[parseInt(time.getDate().toString().split("")[0])-1];
}
strA+=strD;
strA+=" ";
var sta=time.getDay();
strA+=str3[sta];
document.getElementById("Text1").value=strA;
document.getElementById("TextBox1").innerText=strA;
document.all.Label1.innerText=strA;
document.form1.TextBox2.innerText=strA;
}
</script>