1.将整个网页设为黑白色代码如下:
<style type="text/css">
-webkit-filter: grayscale(100%);
</style>
2.将整个网页在一个时间设为黑白色代码如下:
<script src="js/jquery-3.4.0.min.js"></script>
<script type="text/javascript">
$(function() {
var getdate=new Date();
var mon=getdate.getMonth()+ 1;
var date=getdate.getDate();
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
response.write "<style>"
response.write "html {-webkit-filter: grayscale(100%);background:white;filter:progid:DXImageTransform.Microsoft.BasicImage(graysale=1);}"
response.write "</style>"
end if
%>