日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SharePoint 2010/SharePoint 2013 Custom Action: 基于Site Collection 滚动文字的通知.

發布時間:2025/7/25 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SharePoint 2010/SharePoint 2013 Custom Action: 基于Site Collection 滚动文字的通知. 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

應用場景: 有時候我們的站點需要在每個頁面實現滾動文字的通知,怎么在不修改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="101"></CustomAction><CustomAction Location="ScriptLink" ScriptBlock="var windowOnload = window.onload || function(){}; window.onload = function(){ Notification_Demo(); };" Sequence="102"></CustomAction></Elements>


?

  • 創建一個JavaScript?文件,去添加一段Html代碼實現滾動文字。這個JavaScript文件可以放在Layouts目錄下面,也可以放在站點的Style Library中。在HTML中主要使用到Marquee標簽的一些屬性。
function Notification_Demo() {var elemForm = document.getElementsByTagName("form")[0];var elemDiv = document.createElement("div");elemDiv.innerHTML = "<marquee scrollamount='4' style='color:yellow;' οnmοuseοver=this.stop() οnmοuseοut=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.

?

轉載于:https://www.cnblogs.com/dexter2003/p/5909402.html

總結

以上是生活随笔為你收集整理的SharePoint 2010/SharePoint 2013 Custom Action: 基于Site Collection 滚动文字的通知.的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。