IE7 asp.net mvc加载错误

时间:2013-04-08 06:44:59

标签: javascript asp.net asp.net-mvc internet-explorer

我们在使用Internet Explorer 7时遇到问题。 在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;
}

1 个答案:

答案 0 :(得分:2)

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

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