javascript Microsoft JScript 运行时错误:未找到成员

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13647631/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 19:22:16  来源:igfitidea点击:

Microsoft JScript runtime error: Member not found

javascriptasp.net-mvcjquerypartial-viewsjquery-dialog

提问by BrainCoder

i am using asp.net mvc3 and jquery dialogue to open partial view in main view

我正在使用 asp.net mvc3 和 jquery 对话在主视图中打开部分视图

here is my structure..

这是我的结构..

partialview 1

局部视图 1

<input type="button" onclick="function1();">

partial view 2

局部视图 2

<form method="post"> 
    //some elements

    @Html.RenderPartial("partialview1");
</form> 

view 1

视图 1

<script src="myscript.js" />
<script src="jquery.js"/> 
//some element

<div>
    load partialview 2 as jquery dialogue 
</div>

myscript.js

我的脚本.js

  function function1()
  {
     //some code
  }

this is just only overview of my application

这只是我的应用程序的概述

now in above structure if i click on button in the partialview1i am getting this error : Microsoft JScript runtime error: Member not found.

现在在上面的结构中,如果我单击partialview1 中的按钮,我会收到此错误:Microsoft JScript 运行时错误:未找到成员。

回答by BrainCoder

I found the solution in my case.

我在我的案例中找到了解决方案。

<input id="function1" type="button" onclick="function1();">

I have used idof the input type button (ie:function1) as the same name of function (ie:function1).

我使用id了输入类型按钮(即:)function1作为同名的功能(即:)function1

As I don't know much about it. But by changing idof the button or function name solves my problem.

因为我对它了解不多。但是通过更改id按钮或功能名称解决了我的问题。

回答by JBM

Actually, 'Member Not Found' occurs on all browsers and other non-browser programs. In browsers, placing a button or radial with the same name as the function it calls within a form induces this error. Either rename the button or move it outside of the form.

实际上,“找不到成员”出现在所有浏览器和其他非浏览器程序上。在浏览器中,在表单中放置与其调用的函数同名的按钮或圆形会导致此错误。重命名按钮或将其移到窗体之外。