在某一天隐藏 Sharepoint 2013 页面上的 web 部件
Hide web part on Sharepoint 2013 page on certain day
我必须在每个星期五在页面或整个页面(无论我发现什么更快)上隐藏一个 Web 部件。几个月前,我编写了 javascript 代码以在上午 10 点后隐藏 Web 部件,因此我为新目的编辑了该代码。
window.addEventListener("load", function(){
var currentDay = new Date();
var day = currentDay.getDay();
var hideMe = document.getElementById("MSOZoneCell_WebPartWPQ3");
/* This is web part that I need to hide */
if(day=3) { /* I put 3 for today to check if it will work, but I need Friday as a day */
hideMe.style.display = "none";
}
else {
hideMe.style.display = "block";
}
}, false);
我在 If 子句中使用了 == 而不是 =
if(day==3)
现在可以使用了。
我必须在每个星期五在页面或整个页面(无论我发现什么更快)上隐藏一个 Web 部件。几个月前,我编写了 javascript 代码以在上午 10 点后隐藏 Web 部件,因此我为新目的编辑了该代码。
window.addEventListener("load", function(){
var currentDay = new Date();
var day = currentDay.getDay();
var hideMe = document.getElementById("MSOZoneCell_WebPartWPQ3");
/* This is web part that I need to hide */
if(day=3) { /* I put 3 for today to check if it will work, but I need Friday as a day */
hideMe.style.display = "none";
}
else {
hideMe.style.display = "block";
}
}, false);
我在 If 子句中使用了 == 而不是 =
if(day==3)
现在可以使用了。