IE7 asp.net mvc加载错误

IE7 asp.net mvc loading error

本文关键字:加载 错误 mvc net asp IE7      更新时间:2023-09-26

我们在使用ie7时遇到了一个问题。在ASP。. NET MVC 3的结果页面看起来像:

<button type="button" onclick=" ShowOperation('/Page/Box/ShowOperation/CreateBox', '') ">...

和错误(仅在IE7中)看起来像:

Error: The value of the property 'ShowOperation' is null or undefined, not a Function object.

这个函数已经定义在文件page.js中,我们附加在外部

function ShowOperation(operationUrl, type) {
  if (type && type == 'download') {
    var temp = $("#pageGrid").jqGrid('getGridParam', 'selarrrow');
    if(temp.length == 0) {
        ProceedAjax(operationUrl, AjaxWarning);
        return;
    }
    $("#doOperation").attr("action", operationUrl);
    var uu = operationUrl.split("/");
    var action = uu[uu.length-1];
    $("#doOperationAction").val(action);
    $("#doOperationIds").val(temp);
    $("#doOperation").submit();
    return;
  }
  ProceedAjax(operationUrl, AjaxError);
  return;
}

由于该函数是在另一个js文件中定义的,因此在调用onclick时需要在函数名称之前添加javascript:
更新后的代码看起来应该是这样的:

<button type="button" onclick="javascript: ShowOperation('/Page/Box/ShowOperation/CreateBox', '');">