在IE11上,日历功能未被禁用
问题描述:
Hi,
I am using Internet explorer version 11 and an asp.net v4.0 web application. We have the below HTML code to place a calendar image on the web page. It has an onclick event which launches a calendar where user can select a date.
<TD class="tblCellClass" id="tblCellDt" width="24%" runat="server"><A title="Calendar" style="CURSOR: hand" onclick="javascript:void(DOSomething())"><IMG src="SampleImages/Calendar.gif" border="0" width="20" height="20"></A></TD>
Under certain situations, we disable this onclick functionality by disabling the td class "tblCellDt" in javascript as well as in code-behind.
This is how we are disabling in javascript:
document.all.tblCellDt.disabled = true;
and similary in code-behind vb.net file:
tblCellDt.Disabled = True
For some reasons, onclick functionality is getting disabled on Internet Explorere 8 but not on Internet explorer 11. Can you please help ?
答
document.all非常老,不是浏览器因此可能是IE终于停止支持它了。改为使用document.getElementById
document.all is very very old and not a browser standard so it could be that IE has finally stopped supporting it. Use document.getElementById instead
document.getElementById("tblCellDt").disabled = true;
http://www.w3schools.com/jsref/prop_html_disabled.asp [ ^ ]