惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
AWS News Blog
AWS News Blog
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Security @ Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
Attack and Defense Labs
Attack and Defense Labs
Jina AI
Jina AI
The Last Watchdog
The Last Watchdog
W
WeLiveSecurity
H
Help Net Security
V
Visual Studio Blog
宝玉的分享
宝玉的分享
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threat Research - Cisco Blogs
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
Latest news
Latest news
T
Tor Project blog
I
Intezer
美团技术团队
GbyAI
GbyAI
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
Scott Helme
Scott Helme
Y
Y Combinator Blog
博客园 - 司徒正美
T
Tenable Blog
O
OpenAI News
N
News and Events Feed by Topic
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V
Vulnerabilities – Threatpost
P
Palo Alto Networks Blog
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Threatpost
Google Online Security Blog
Google Online Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
Help Net Security
Help Net Security

博客园 - Sunmoonfire

SharePoint 2013无代码实现列表视图的时间段动态筛选 SharePoint 2013:自定义ECB菜单项的添加 SharePoint Foundation 2013 with SP1 在SharePoint列表中使用自增栏 SharePoint 2010自定义母版页小技巧——JavaScript和CSS引用 修改SharePoint列表项显示“新”图标的天数 通过PowerShell实现SharePoint列表增删改 在SharePoint 2010页面中嵌入SWF文件 在LINQ to SharePoint中使用创建时间,创建者,修改时间,修改者 SharePoint 2010之LINQ与SPMetal 修改SharePoint页面上的控件数量的限制 SharePoint 2010:部署.resx(资源)文件到App_GlobalResources的简单方法 在SharePoint 2010环境下区分w3wp进程 打SharePoint 2010 SP1后访问用户配置文件同步服务应用程序出错的解决办法 使用[本人]创建视图筛选时的一个问题和解答 "缺少服务器端相关性"的内容定位 SharePoint 2010开发工具图解系列:Visual Studio 2010创建事件接收器 SharePoint 2010开发工具图解系列:Visual Studio 2010创建列表 SharePoint 2010开发工具图解系列:Visual Studio 2010 SharePoint Tool入门
在SharePoint 2010中使用jQuery
Sunmoonfire · 2012-07-27 · via 博客园 - Sunmoonfire

我们可以使用jQuery来定制SharePoint 2010。本文的目标受众是那些具备SharePoint 2010实施能力的开发者,他们希望可以在SharePoint中用jQuery。本文将会介绍如何将jQuery集成到SharePoint 2010中。在Visual Studio 2010中,现在默认已经具备了对jQuery的支持。Visual Studio2010中包含了jQuery 1.4的代码智能提示,使得我们代码的编写变得非常轻松。

步骤

通过以下简单的几步,就可以将jQuery集成到SharePoint站点。

  • 创建一个空白站点(我比较常用。你可以使用任何你喜欢的网站模板)

  • http://docs.jquery.com/Downloading_jQuery下载jQuery
  • 在14目录(也就是<SharePoint安装路径>\14\TEMPLATE\LAYOUTS)下创建一个文件夹,这里创建了一个名为“CustomJS”的文件夹。这一步不是必须的,你也可以不创建,而是放在项目的后台应用程序目录中。
  • 拷贝jQuery的脚本文件到这个文件夹。

  • 打开SharePoint Designer ,并打开站点的默认母板页。默认情况下SharePoint 2010使用v4.master作为站点的默认母板页以及自定义模板页。

  • 添加如下的“ScriptLink”标记。不要添加OnDemand="True"标记。否则默认情况下,jQuery不会被加载。

  •  保存该母板页。
  • 签入并发布该母板页。根据实际情况,你可能还需要审批该页面的这个版本。
  • 好了。现在你需要验证一下jQuery在我们访问站点的时候确实被加载了。
  • 打开IE并浏览到你的站点。
  • 按F12打开“开发人员工具”(你的IE 需要是IE8以上版本才行)
  • 转到“脚本”选项卡,验证jQuery是否加载。

  • 做一个快速完整性测试,转到脚本选项卡,在右侧的控制台窗口中写入类似这样的代码,$("#MSO_ContentTable").css("background-color","green");然后点击“运行脚本”按钮。
  • 确认页面主要区域的背景色被改为绿色。

OK了。现在你可以开始使用jQuery进行客户端脚本开发了。

如果需要添加你自己的脚本,你也可以使用类似上面的方法。比如,使用<script>标记。大家赶快来玩玩儿吧!

参考资料

Using jQuery with SharePoint 2010