如何在html页面中添加jquery作为动态crm 2011中的Web资源 [英] how do you add jquery in a html page as a web resource in dynamics crm 2011
问题描述
这个问题很麻烦。我试图在HTML页面中运行一个简单的
jquery脚本,只弹出一个警告框。
我已经上传了jquery库和json library
我有一个带有以下引用和对我的jquery脚本的引用的html页面。当我将这个html嵌入到iframe中时,它并没有提出警告。
< SCRIPT src =.. /ClientGlobalContext.js.aspx\"></SCRIPT>
< SCRIPT type = text / javascript src =../ jquery1.4.1.min.js>< / SCRIPT>
我正在阅读一些关于相对路径的内容,以及我曾经尝试过的内容
< SCRIPT type = text / javascript src =../ Script / jquery1.4.1.min.js>< / SCRIPT>
二者。
。
我看到两个选项可供您使用。 strong>选项1:相对路径
网络资源可以通过相对路径指向彼此。所以,它实际上取决于你的html web资源的名称和你的jquery web资源。
Web资源的名称被创建。所以,你要密切关注这一点。 (尽管您可以随时删除它并使用新名称重新创建它。)此名称值可以包含路径。
例如,您的jQuery库Web资源可能会有一个/Scripts/jquery.js的名称。如果您的html页面(您的iframe指向的)名称为/Pages/mypage.html,那么该html页面必须像这样引用jQuery库:
< script src =../ Scripts / jquery.js>< / script>
它必须升级才能离开Pages文件夹,然后进入Scripts文件夹,并击中jquery.js文件。您可以将此视为一个真正的文件系统,就好像您正在使用常规的ASP.NET网站一样。
选项2:CDN 在其内容分发网络(CDN)上的
Google(和其他网络)主机库(如jQuery)。他们将这些设计得非常快速和可靠。如果你不介意需要通过互联网连接你的功能,你可以直接链接到Google的CDN上的jquery。
为此,更改脚本标签为jQuery:
< script src =https://ajax.googleapis.com/ajax/libs/的jquery / 1.5.1 / jquery.min.js>< /脚本>
having a lot of trouble with this one. I am trying to run a simple jquery script inside of an html page to just pop up an alert box.
I have uploaded the jquery library and the json library
I have an html page with the following references and the reference to my jquery script. It is not coming up with the alert however when I embed this html as an iframe.
<SCRIPT src="../ClientGlobalContext.js.aspx"></SCRIPT>
<SCRIPT type=text/javascript src="../jquery1.4.1.min.js"></SCRIPT>
I was reading something about relative paths and what have you I have tried
<SCRIPT type=text/javascript src="../Script/jquery1.4.1.min.js"></SCRIPT>
<SCRIPT type=text/javascript src="../Scripts/jquery1.4.1.min.js"></SCRIPT>
both.
But its not working.
I see two options available to you.
Option 1: Relative Paths Web Resources can point to each other via relative paths. So, it really depends on the "Name" of your html web resource and your jquery web resources.
The "Name" of a web resource cannot be changed after it has been created. So, you want to pay close attention to this. (You can always delete it and create it again with a new name, though.) This Name value can have a path in it.
For example, your jQuery library web resource might have a Name of "/Scripts/jquery.js". If you html page (that your iframe points to) has a name of "/Pages/mypage.html", then that html page must reference the jQuery library like so:
<script src="../Scripts/jquery.js"></script>
It has to go up a level to get out of the Pages folder, then down into the Scripts folder, and hits the jquery.js file. You can think of this as a real file system, as if you were working with a regular ASP.NET site.
Option 2: CDN Google (and other networks) host libraries like jQuery on their Content Delivery Networks (CDN). They designed these to be extremely fast and reliable. If you don't mind requiring a connection to the internet for your functionality to work, you can link directly to jquery on Google's CDN.
To do this, change your script tag for jQuery to this:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
这篇关于如何在html页面中添加jquery作为动态crm 2011中的Web资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!