gpt4 book ai didi

javascript - 在某一天隐藏 Sharepoint 2013 页面上的 Web 部件

转载 作者:行者123 更新时间:2023-12-03 06:01:14 24 4
gpt4 key购买 nike

我必须在每个星期五隐藏页面或整个页面上的一个 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)  

现在它可以工作了。

关于javascript - 在某一天隐藏 Sharepoint 2013 页面上的 Web 部件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39745948/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com