为什么在示例SDK脚本中出现javascript错误
Why getting javascript errors with sample SDK script?
我在dynamics CRM中创建了以下简单的web资源,使用OData使用rest API。请考虑,new_JavaScriptRESTDataOperationsSample是带有SDK的示例,我只创建了以下示例HTML。
<HTML><HEAD><TITLE>OData</TITLE>
<META charset=utf-8></HEAD>
<BODY>
<SCRIPT type=text/javascript src="ClientGlobalContext.js.aspx"></SCRIPT>
<SCRIPT type=text/javascript src="new_SDK.REST"></SCRIPT>
<SCRIPT type=text/javascript src="new_json2"></SCRIPT>
<SCRIPT type=text/javascript src="new_JavaScriptRESTDataOperationsSample"></SCRIPT>
<BUTTON onclick=createAccount();>Click Me!</BUTTON></BODY></HTML>
当我点击点击我按钮会出现以下错误,
网页错误详细信息
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3) Timestamp: Mon, 29 Sep 2014 07:38:45 UTC
Message: 'startButton' is null or not an object Line: 32 Char: 3 Code: 0 URI: http://dynamicscrm01/CRM01/%7B635475719080000809%7D/WebResources/new_JavaScriptRESTDataOperationsSample
Message: 'output' is null or not an object Line: 199 Char: 2 Code: 0 URI: http://dynamicscrm01/CRM01/%7B635475719080000809%7D/WebResources/new_JavaScriptRESTDataOperationsSample
很抱歉格式不正确,所以不允许在块引号中使用链接。
sample_/Scripts/JavaScriptRESTDataOperationsSample
连接到sample_/JavaScriptRESTDataOperationsSample.htm
web资源。
示例:使用JavaScript 的OData端点创建、检索、更新和删除
如果你查看CreateAccount
函数内部,你会发现以下行:
startButton = document.getElementById("start");
output = document.getElementById("output");
因此脚本期望在HTML文件中存在这些对象。在您的示例中,您只包含按钮,但sample_/JavaScriptRESTDataOperationsSample.htm
web资源包含请求的对象:
<button id="start" title="Click this button to start the sample.">
Start</button>
<button id="reset" title="Click this button to reset the sample." disabled="disabled">
Reset</button>
<ol id="output">
</ol>
相关文章:
- JavaScript错误:Microsoft JScript运行时错误:应为对象
- 将字符串拆分为数组时出现JavaScript错误
- 处理JSON字符串会导致JavaScript错误
- 使用AJAX在剑道网格中分组时出现Javascript错误
- Ajax对web URL的调用导致javascript错误
- 为什么当我尝试在Ionic中使用列表时会出现此JavaScript错误
- 可以't解决Javascript错误
- django出现神秘的javascript错误
- JavaScript错误无效的限定符
- 使用主题运行时portlet liferay时出现Javascript错误
- 绑定函数时在IE7中未实现Javascript错误
- Javascript错误:未捕获引用错误:未定义编辑
- eventListener出现JavaScript错误
- sharepoint站点的internet explorer中出现Javascript错误
- LoadControl HttpCompileException自定义服务器控件JavaScript错误
- 销毁Bootstrap popover时出现Javascript错误
- 无法加载Javascript错误XMLHttpRequest
- 使用JSON.parse时出现无效字符javascript错误
- 修复Javascript错误
- 模板字符串上的netbeans javascript错误(backticks)