为什么使用示例SDK脚本获取javascript错误?

为什么使用示例SDK脚本获取javascript错误?,javascript,html,dynamics-crm-2011,odata,Javascript,Html,Dynamics Crm 2011,Odata,我在dynamics CRM中创建了以下简单的web资源,使用OData使用RESTAPI。请考虑,NexJavaScript PrestDATA操作示例是SDK的示例,我只创建了以下示例HTML。p> <HTML><HEAD><TITLE>OData</TITLE> <META charset=utf-8></HEAD> <BODY> <SCRIPT type=text/javascript src="

我在dynamics CRM中创建了以下简单的web资源,使用OData使用RESTAPI。请考虑,NexJavaScript PrestDATA操作示例是SDK的示例,我只创建了以下示例HTML。p>
<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>
很抱歉格式不正确,因此不允许在块引号中使用链接。

MSDN示例\uuu/Scripts/JavaScriptRESTDataOperationsSample已连接到示例\uu/JavaScriptRESTDataOperationsSample.htm web资源

如果查看CreateCount函数内部,您将发现以下行:

startButton = document.getElementById("start");
output = document.getElementById("output");
因此,脚本希望在HTML文件中存在这些对象。在您的示例中,您只包含按钮,但示例/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>
<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>