从另一个JavaScript网络资源调用JavaScript函数 [英] Call javascript function from another javascript webresource
问题描述
CRM 2011中有一个JavaScript网络资源,名为 new\_ / Script / genericJScript.js
。其中包含一些函数,例如 \_retrieveRecord()
和 \_Context()
,如下所示。而且我需要从另一个名为 new\_ / Script / testJScript.js
的JavaScript网络资源中调用这些方法。我们该怎么做呢?
There is one JavaScript web resource in CRM 2011 called new\_/Script/genericJScript.js
. Which contains some functions say, \_retrieveRecord()
and \_Context()
as below. And I need to call these methods from another JavaScript web resource called new\_/Script/testJScript.js
. How can we do this?
if (typeof (MyTest) == "undefined")
{
MYTEST = { __namespace: true };
}
MYTEST.RESTCALL = {
_Context: function () {
......
},
_retrieveRecord: function () {
......
},
};
推荐答案
假设您在表单中同时包含这两种资源(我是假设您是从()执行此操作,则以下内容应有效:
Assuming you include both resources on your form (I am assuming you are doing this from), the following should be valid:
webresource1.js
function HelloWorld() {
alert('Hello, world!');
}
webresource2.js
//should alert 'Hello, World!' using the method from the other webresource
HelloWorld();
这篇关于从另一个JavaScript网络资源调用JavaScript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!