<html>
<head>
<script type="text/javascript">
function nameofmonth(month)
{
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
return monthname[month]
}
function monthdays(month,year)
{
var daysofmonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31)
if(year%4==0)
daysofmonth[1]=29
return daysofmonth[month]
}
function close(){
document.getElementById("container").style.display='none'
}
function table()
{
var now=new Date()
var hour=now.getHours()
var minute=now.getMinutes()
var second=now.getSeconds()
var date=now.getDate()
var month=now.getMonth()
var year=now.getFullYear()
now.setFullYear(year,month,1)
var firstday=now.getDay()
var monthname=nameofmonth(month)
var daysofmonth=monthdays(month,year)
if(firstday>0)
var k=-(firstday-1)
else
k=1
var table="<table border=5 cellspacing=3cellpadding=8>"
table +="<tr><th colspan=7>"+monthname + date+"th</th> <td style='cursor:pointer' onclick='close()'>[close]</td></tr>"
table +="<tr><th>sun</th><th>mon</th><th>tue</><th>wed</th><th>thu</th><th>fri</><th>sat</th></tr>"
for(var i=0;i<5;i++)
{
table+="<tr>"
for(var j=0;j<7;j++)
{
if(k<=daysofmonth && k>0)
{ if(k==date)
table+='<td id="clock" bgcolor="aqua">'+k+'</td>'
else
table+='<td style="cursor:pointer">'+k+'</td>'
k=parseInt(k)
}
else
table+="<td></td>"
k++
}
table+="</tr>"
document.getElementById("calender").innerHTML=table
}
}
</script>
</head>
<body>
<input type="text" onclick="table()"/>
<table id="container"><tr><td id="calender"></td></tr></table>
</body>
</html>
这是我单击文本框后出现的日历代码。这是表格中的一个关闭单元格。单击关闭时,将调用 close() 函数并且日历将消失。但这没有发生。为什么?请帮助我...提前致谢..