应用场景: 有时候我们的站点需要在每个页面实现滚动文字的通知,怎么在不修改Master Page的情况下实现这个功能?我们可以使用Javascript 和 Custom Action 来实现。

  • 创建一个Custom Action。主要使用到 Location = 'ScriptLink' 属性, 该属性可以动态的加载JavaScript 文件链接和代码块到模板页。代码如下:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <CustomAction Location="ScriptLink"
criptSrc="/_layouts/15/SP2013NotificationDemo/SiteNotification.js"
Sequence=""></CustomAction> <CustomAction Location="ScriptLink"
ScriptBlock="var windowOnload = window.onload || function(){}; window.onload = function(){ Notification_Demo(); };"
Sequence=""></CustomAction> </Elements>
  • 创建一个JavaScript 文件,去添加一段Html代码实现滚动文字。这个JavaScript文件可以放在Layouts目录下面,也可以放在站点的Style Library中。在HTML中主要使用到Marquee标签的一些属性。
function Notification_Demo() {
var elemForm = document.getElementsByTagName("form")[];
var elemDiv = document.createElement("div");
elemDiv.innerHTML = "<marquee scrollamount='4' style='color:yellow;' onmouseover=this.stop() onmouseout=this.start()>This is a Marquee test!!!</marquee>";
elemDiv.style.cssText = "background:red;width:100%;font-size:20px;";
document.body.insertBefore(elemDiv, elemForm);
}
  • 代码结构图如下:

Feature Scope 设置成了Site. 如果需要把这个滚动通知应用到一个web application下面的多个site collection中,可以把Feture scope 设置成Web Application.

SharePoint 2010/SharePoint 2013 Custom Action: 基于Site Collection 滚动文字的通知.的更多相关文章

  1. SharePoint 2013 How to Backup Site Collection Automatically With a PowerShell Script

    In this post I will introduce a way how to run a script for backing up SharePoint data which could b ...

  2. [SharePoint 2010] SharePoint 2010 部署、收回和删除解决方案----STSADM和PowerShell

    STSADM stsadm -o addsolution –filename c:\bin\CustomerSiteSearch.wsp stsadm -o deploysolution –name ...

  3. SharePoint 2010、2013多个域之间互信(Domain Trust)的设计与实施

    在现实的业务场景中,有时为了更好的管理域用户和服务.我们往往会创建多个分散式的域,每个域的Administrator专注于维护特定域中的用户和资源,Administrator也可以定义安全策略,比如账 ...

  4. [SharePoint 2010] SharePoint 2010上多人同時編輯Office 2010文件

    Office 2010這個版本,提供了一個令人興奮的新功能,那就是它可以讓多人同時編輯一份Office 2010的文件. 這是一個很大的突破. 以往在與SharePoint搭配下的分享環境,檔案只能被 ...

  5. [SharePoint 2010] SharePoint 2010 FBA 配置以及自定义首页

    https://blogs.msdn.microsoft.com/kaevans/2010/07/09/sql-server-provider-for-claims-based-authenticat ...

  6. SharePoint 2010 将带有工作流的模板移动到另一个站点集

    HOWTO Move or Migrate SharePoint 2010 List-based Workflows between Sites and Site Collections I’ve e ...

  7. [SharePoint 2010] 自定义字段类型开发(二)

    在SharePoint 2010中实现View Action Button效果. http://www.sharepointblogs.be/blogs/vandest/archive/2008/06 ...

  8. sharepoint 2010 列表数据分页控件介绍 pagination UserControl

    转:http://blog.csdn.net/chenxinxian/article/details/8714391 这里主要是介绍下最近开发的一个sharepoint列表或者文档库的分页控件,并且把 ...

  9. SharePoint 2010 Form Authentication (SQL) based on existing database

    SharePoint 2010 表单认证,基于现有数据库的用户信息表 本文主要描写叙述本人配置过程中涉及到的步骤,仅作为參考,不要仅限于此步骤. 另外本文通俗易懂,适合大众口味儿. I. 开启并配置基 ...

随机推荐

  1. HDU1358:Period

    第一次做KMP.还没有理解透. 在自己写一遍时没有让next[0]初始化为-1. 还有就是next应该是c++中的关键字,提交后编译错误. From: http://blog.csdn.net/lib ...

  2. Android ListView动态改变Item高度

    在adapter的getView方法中进行设置,代码如下 @Override public View getView(int position, View convertView, ViewGroup ...

  3. CSS之全屏背景图

    吐槽啦:Yeah  明天就是国庆了o(* ̄▽ ̄*)o!哈哈,提前祝福各位园友国庆快乐.假期愉快.生活美满.天天开心!国庆我要回家一趟,把一些不用的东西带回家,走访一下亲朋好友,在家打几天酱油~~~ 言 ...

  4. UI1_ViewController视图切换及Appdelegate

    // // ThirdViewController.h // UI1_ViewController视图切换及Appdelegate // // Created by zhangxueming on 1 ...

  5. WCF之数据契约

    从抽象层面看,WCF能够托管CLR类型(接口和类)并将它们公开为服务,也能够以本地CLR接口和类的方式使用服务.然而,CLR类型却属于.NET的特定技术.由于面向服务的一个核心原则就是在跨越服务边界时 ...

  6. 支持向量机 support vector machine

    SVM(support Vector machine) (1) SVM(Support Vector Machine)是从瓦普尼克(Vapnik)的统计学习理论发展而来的,主要针对小样本数据进行学习. ...

  7. MySQL 密码增强插件

    200 ? "200px" : this.width)!important;} --> 介绍 以前没有太注意MySQL密码安全策略的配置方法,只是人为了将密码设为复杂密码,但 ...

  8. 《Apache数据传输加密、证书的制作》——涉及HTTPS协议

    首先了解http和https: HTTPS(Secure Hypertext Transfer Protocol)安全超文本传输协议. HTTPS和HTTP的区别: http是超文本传输协议,信息是明 ...

  9. elr_memory_pool详解

    Preface Usually, memory allocation of OS is fast, especially the computer has just started. But over ...

  10. PHP类的自动载入机制

    php的自动加载: 在php5以前,我们要用某个类或类的方法,那必须include或者require,之后才能使用,每次用一个类,都需要写一条include,麻烦 php作者想简单点,最好能引用一个类 ...