function ShowCalendar(InputBox) //页面onclick调用此方法,参数是调用此方法的输入框的id
{
var x,y,intLoop,intWeeks,intDays;
var DivContent;
var year,month,day;
var o=eval("document.all."+InputBox); //就是这了,firefox执行到这就报undefine错误,请问该如何改
var thisyear;
thisyear=new getToday();
thisyear=thisyear.year;
today = o.value;
if(isDate(today))
today = new getStringDay(today);
else
today = new getToday();
x=o.offsetLeft;
y=o.offsetTop;
while(o=o.offsetParent)
{
x+=o.offsetLeft;
y+=o.offsetTop;
}
document.all.CalendarIframe.style.left=x+2;
document.all.CalendarIframe.style.top=y+20;
document.all.CalendarIframe.style.visibility="visible";
document.all.Calendar.style.left=x+2;
document.all.Calendar.style.top=y+20;
document.all.Calendar.style.visibility="visible";
//下面开始输出日历表格(border-color:#9DBAF7)
DivContent="<table border='0' cellspacing='0' style='width:153px;border:1px solid #0066FF; background-color:#EDF2FC'>";
DivContent+="<tr height='20px'>";
DivContent+="<td style='border-bottom:1px solid #0066FF; background-color:#C7D8FA'>";
//年
DivContent+="<select name='Year' id='Year' onChange='newCalendar()' style='font-family:Verdana; font-size:12px'>";
for (intLoop = thisyear - 100; intLoop < (thisyear + 100); intLoop++)
DivContent+="<option value= " + intLoop + " " + (today.year == intLoop ? "Selected" : "") + ">" + intLoop + "</option>";
DivContent+="</select>";
//月
DivContent+="<select name='Month' id='Month' onChange='newCalendar()' style='font-family:Verdana; font-size:12px'>";
for (intLoop = 0; intLoop < months.length; intLoop++)
DivContent+="<option value= " + (intLoop + 1) + " " + (today.month == intLoop ? "Selected" : "") + ">" + months[intLoop] + "</option>";
DivContent+="</select>";
DivContent+="</td>";
DivContent+="<td style='border-bottom:1px solid #0066FF; background-color:#C7D8FA; font-weight:bold; font-family:Wingdings 2,Wingdings,Webdings; font-size:16px; padding-top:2px; color:#4477FF; cursor:hand' align='center' title='关闭' onClick='javascript:HiddenCalendar()'>S</td>";
DivContent+="</tr>";
DivContent+="<tr><td align='center' colspan='2'>";
DivContent+="<table id='calendar' border='0' width='100%' height='140px'>";
//星期
DivContent+="<tr height='20px'>";
for (intLoop = 0; intLoop < days.length; intLoop++)
DivContent+="<td align='center' style='font-size:12px'>" + days[intLoop] + "</td>";
DivContent+="</tr>";
//天
for (intWeeks = 0; intWeeks < 6; intWeeks++)
{
DivContent+="<tr>";
for (intDays = 0; intDays < days.length; intDays++)
DivContent+="<td onClick='GetDate(\"" + InputBox + "\")' style='cursor:hand; border-right:1px solid #BBBBBB; border-bottom:1px solid #BBBBBB; color:#215DC6; font-family:Verdana; font-size:12px' align='center'></td>";
DivContent+="</tr>";
}
DivContent+="</table></td></tr>";
DivContent+="<tr><td align='center'><input type='button' onclick='javascript:clearInput(\""+InputBox+"\");' value=' 清除 '/></td></tr>";
DivContent+="</table>"; document.all.Calendar.innerHTML=DivContent;
newCalendar();
}
解决方案 »
- 继续上次的问题,Chorme下怎么只靠JS来刷新一个POST的页面
- ########### 如何将变量内容读入到IFRAME的编辑器中? ################
- [共享 散分] 我的JS框架基类
- JAVAScript中\"表示什么
- 问个问题,我想实现的效果没有被实现(动态添加DIV)
- 有点难度,cookie里存的是父页面的句柄,但是取出来的时候却不能用了?
- 谁能给你一个创建无极菜单的例子,100分敬候!
- 急!有一个图片,如何用js把其中的某个区域突出显示?
- 简单问题:怎么知道页面上有多少控件及控件的类型
- A.HTML里嵌套了B.asp,如何将这两者的数据互传
- 弹出层,页面变灰不能操作
- ext 在iframe中的父窗口弹出的子窗口如何遮罩住整个页面
return document.all[InputBox];
}();你看下行不行,如果不行的话document.all这个方法就要换了
document.getELementById(id)
document.getELementsByName(name)
eval在ie下也很耗性能。
eval is evil