我的主页上有这段代码:
<script type="text/javascript">
function silentErrorHandler() { return true; }
window.onerror = silentErrorHandler;
alert("handled");
</script>
但我仍然收到此错误: 错误:无法获取属性'scrollLeft'的值:object为null或undefined
如何在不必在ie?
中设置禁用脚本调试的情况下完全抑制这些错误我会解决这个错误,但是我花了很长时间看这个问题并没有人对我的其他帖子发表评论: https://stackoverflow.com/questions/7915208/jscript-runtime-error-on-callback-using-updatepanel
<%@ Page Title="" Language="VB" MasterPageFile="~/WinPlan.master" AutoEventWireup="false"
CodeFile="Scheduler.aspx.vb" Inherits="Scheduler" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
<asp:Content ID="PageHeadContent" ContentPlaceHolderID="page_header_content" runat="Server">
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server" EnableViewState="true">
</asp:ScriptManagerProxy>
<asp:UpdatePanel ID="upnlSearchBar" runat="server">
<ContentTemplate>
<div class="searchBar">
<table id="userSearchBar">
<tr>
<td align="left">
<asp:Label ID="Label1" runat="server" Text="From: " Font-Bold="true" Width="50"></asp:Label>
</td>
<td align="left">
<asp:TextBox ID="txtFromDate" runat="server" Width="80"></asp:TextBox>
<asp:ImageButton ID="imgCalendarFrom" runat="server" Width="18" ImageUrl="~/Images/SmallCalendar.gif" />
<act:CalendarExtender ID="CalendarExtenderFrom" runat="server" Format="dd/MM/yyyy"
Enabled="true" PopupButtonID="imgCalendarFrom" TargetControlID="txtFromDate">
</act:CalendarExtender>
</td>
<td align="left">
<asp:Label ID="l3" Text="" runat="server" Width="20"></asp:Label>
</td>
<td align="left">
<asp:Label ID="Label2" runat="server" Text="To: " Font-Bold="true" Width="30"></asp:Label>
</td>
<td align="left">
<asp:TextBox ID="txtToDate" runat="server" Width="80"></asp:TextBox>
<asp:ImageButton ID="imgCalendarTo" runat="server" Width="18" ImageUrl="~/Images/SmallCalendar.gif" />
<act:CalendarExtender ID="CalendarExtenderTo" runat="server" Format="dd/MM/yyyy"
Enabled="true" PopupButtonID="imgCalendarTo" TargetControlID="txtToDate">
</act:CalendarExtender>
</td>
<td align="left">
<asp:Label ID="l4" Text="" runat="server" Width="20"></asp:Label>
</td>
<td align="left">
<asp:Button ID="btnSearchSchedules" runat="server" Text="Search" Width="60px" BorderStyle="None"
Height="22px" ForeColor="White" CssClass="btn" />
</td>
<td align="left">
<asp:Label ID="L5" Text="" runat="server" Width="20"></asp:Label>
</td>
<td valign="middle">
<asp:Button ID="btnUsers" runat="server" Text="Users" Width="60px" BorderStyle="None"
Height="22px" ForeColor="White" CssClass="btn" OnClientClick="editUsers();" />
</td>
<td align="left" valign="middle">
<asp:Label ID="L6" Text="" runat="server" Width="20"></asp:Label>
</td>
<td valign="bottom">
<asp:CheckBox ID="chkBusinessHours" runat="server" Text=" Show Business Hours Only"
Height="22px" BorderColor="Transparent" Font-Bold="true" ForeColor="Black" AutoPostBack="true" />
</td>
<td width="40px">
</td>
</tr>
</table>
<table id="adminSearchBar" runat="server">
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="main_content" runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<ContentTemplate>
<div id="dp">
<DayPilot:DayPilotScheduler ID="DayPilotScheduler1" runat="server" CellGroupBy="Day"
DataStartField="StartDate" DataEndField="EndDate" ScrollLabelsVisible="true"
DataTextField="CustomerName" DataValueField="Workcard" DataResourceField="EmployeeCode"
CellDuration="60" CellWidth="50" ViewType="Resources" Width="100%" Heigth="100%"
RowMinHeight="30" RowHeaderWidth="150" HeigthSpec="Max" HeaderFontSize="10pt"
HeaderWidth="150px" HeaderHeight="20" EventFontSize="8pt" EventMoveHandling="CallBack"
TimeFormat="Clock12Hours" DurationBarVisible="false" BusinessBeginsHour="8" BusinessEndsHour="18"
ClientObjectName="dps" EventClickHandling="JavaScript" EventClickJavaScript="editEvent(e.value());"
OnCommand="DayPilotScheduler1_Command" EventCorners="Regular" RowMarginBottom="5"
ContextMenuID="DayPilotContextMenu" TreeIndent="15" TreeImageNoChildren="images/tree_nochildren.png"
TreeImageCollapse="images/tree_collapse.png" TreeImageExpand="images/tree_expand.png"
CssClassPrefix="scheduler_" EventBackColor="" EventFontFamily="" HourNameBackColor=""
HourFontFamily="" HourFontSize="" HeaderFontFamily="" HourBorderColor="" BackColor="#ececfe"
NonBusinessBackColor="White" CellBorderColor="Silver" OnBeforeResHeaderRender="DayPilotScheduler1_BeforeResHeaderRender"
AutoRefreshEnabled="true" AutoRefreshInterval="10" HeightSpec="Max" Height="630">
</DayPilot:DayPilotScheduler>
<DayPilot:DayPilotMenu ID="DayPilotContextMenu" runat="server" CssClassPrefix="menu_">
<DayPilot:MenuItem Action="Javascript" JavaScript="redirect()" Command="Details"
Text="View Job Creator" />
</DayPilot:DayPilotMenu>
<asp:UpdateProgress DynamicLayout="false" DisplayAfter="1" ID="UpdateProgress2" runat="server">
<ProgressTemplate>
<div class="Progress">
<img src="./images/ajax-loader.gif" />
Loading ...
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<act:AlwaysVisibleControlExtender ID="AlwaysVisible" runat="server" TargetControlID="UpdateProgress2"
HorizontalSide="Center" VerticalSide="Middle" HorizontalOffset="0">
</act:AlwaysVisibleControlExtender>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
答案 0 :(得分:0)
来自Microsoft文档:
onerror事件会触发运行时错误,但不会触发编译错误。此外,脚本调试程序引发的错误对话框不会通过返回true来抑制。要关闭脚本调试程序,请从“工具”菜单中选择“Internet选项”,以禁用Internet Explorer中的脚本调试。单击“高级”选项卡,然后选中相应的复选框。
从好的方面来看,大多数普通IE用户(或任何其他浏览器的用户)都没有启用脚本调试。
答案 1 :(得分:0)
似乎JavaScript代码是由服务器端生成的,因为您的ASP.net代码不包含任何JavaScript代码。结果,很难说出错的地方。