1.将整个网页设为黑白色代码如下:
<style type="text/css">
-webkit-filter: grayscale(100%);
</style>
2.将整个网页在一个时间设为黑白色代码如下:
<script src="js/jquery-3.4."></script>
<script type="text/javascript">
$(function() {
var getdate=new Date();
var mon=()+ 1;
var date=();
if(mon==4&&date==4){
$("body").css({webkitFilter: 'grayscale(100%)'});
}
})
</script>
3.将整个网站在一个时间段设为黑白色代码如下(asp页面):
<%
dim StartTime
dim EndTime
dim NowTime
StartTime = cdate("2020-4-4 00:00:00")
EndTime = cdate("2020-4-4 23:59:59")
NowTime = now()
if NowTime > StartTime and NowTime < EndTime then
"<style>"
"html {-webkit-filter: grayscale(100%);background:white;filter:progid:(graysale=1);}"
"</style>"
end if
%>