我使用以下代码进行日历控制,将所选日期返回到文本字段。这对IE 8以下的浏览器工作得很好,但不适用于IE 9.有人可以提供一些见解来修复这个日历控件,以便在IE 9或10中工作。
F12开发人员工具控制台消息:
HTML1113:文档模式从IE9标准重新启动到Quirks
另外:
SCRIPT438:对象不支持此属性或方法:' document.all.calendar1.value'
<head>
<title>SELECT A DATE</title>
<!--<meta http-equiv="X-UA-Compatible" content="IE=8" />-->
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
</head>
<BODY bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0 bgcolor=#cccac0>
<SCRIPT LANGUAGE=VBSCRIPT>
Sub window_onunload
window.returnvalue = formatdatetime(document.all.Calendar1.value,2)
end sub
</SCRIPT>
<!--<SCRIPT LANGUAGE=VBSCRIPT>
Sub window_onunload
window.returnvalue = formatdatetime(document.getElementById("Calendar1"))
end sub
</SCRIPT>-->
<OBJECT id="Calendar1" style="LEFT: 0px; WIDTH: 289px; TOP: 0px; HEIGHT: 198px"
classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02" width=289 height=198 VIEWASTEXT class="Calendar">
<PARAM NAME="_Version" VALUE="524288">
<PARAM NAME="_ExtentX" VALUE="7646">
<PARAM NAME="_ExtentY" VALUE="5239">
<PARAM NAME="_StockProps" VALUE="1">
<PARAM NAME="BackColor" VALUE="-2147483633">
<PARAM NAME="Year" VALUE="<%=year(now())%>">
<PARAM NAME="Month" VALUE="<%=month(now())%>">
<PARAM NAME="Day" VALUE="<%=day(now())%>">
<PARAM NAME="DayLength" VALUE="1">
<PARAM NAME="MonthLength" VALUE="2">
<PARAM NAME="DayFontColor" VALUE="0">
<PARAM NAME="FirstDay" VALUE="1">
<PARAM NAME="GridCellEffect" VALUE="1">
<PARAM NAME="GridFontColor" VALUE="10485760">
<PARAM NAME="GridLinesColor" VALUE="-2147483632">
<PARAM NAME="ShowDateSelectors" VALUE="-1">
<PARAM NAME="ShowDays" VALUE="-1">
<PARAM NAME="ShowHorizontalGrid" VALUE="-1">
<PARAM NAME="ShowTitle" VALUE="-1">
<PARAM NAME="ShowVerticalGrid" VALUE="-1">
<PARAM NAME="TitleFontColor" VALUE="10485760">
<PARAM NAME="ValueIsNull" VALUE="0">
</OBJECT>
<BR>
<center><!-- <INPUT type=button value="Select Date" onClick=window.close></center> -->
<img src="selectadate.png" alt="Select a Date" onClick=window.close>
</BODY>
答案 0 :(得分:0)
尝试替换
document.all
与
document.forms[0]
如果脚本中只有一个表单