SharePoint里面自带了一个Content Editor Webpart, 使用这个webpart。能够方便的往页面上加入随意的内容(HTML,css, JS)。以此来达到往页面加入自己定义内容的目的。

当然,讲到这里。JQuery 也是不可缺少的了。那么怎样在Content Editor Webpart里加入JQuery呢?

1.      首先在Style Library里,上传JQuery

Content Editor Webpart(一)引用JQuery-LMLPHP

2.      然后打开一个页面。编辑页面,增加一个Content Editor Webpart。选中Content Editor Webpart, 在Ribbon上点击Edit Source:

Content Editor Webpart(一)引用JQuery-LMLPHP

3.      在里面引用JQuery:

<scripttype="text/javascript"src="/sites/apps/Style%20Library/jquery-1.10.2.min.js"></script>​​​​​​​
<scripttype="text/javascript">
jQuery(document).ready(function(){ alert("JqueryLoaded!"); });
</script>​​​​​​​​​

Content Editor Webpart(一)引用JQuery-LMLPHP

点OK。

4.      停止编辑。保存页面,刷新,得到以下的提示:

Content Editor Webpart(一)引用JQuery-LMLPHP

说明JQuery载入成功了。

05-11 17:27