2010-8-15全国哀悼舟曲遇难同胞,网站变灰色

本文介绍了一种使用JavaScript和CSS自动将网页元素变为灰色的方法,并针对特定日期应用此效果。此外,还探讨了使Flash内容灰化的限制及替代方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、以下代码可自动根据设定的日期调整颜色为灰色。可在页面<head></head>中间添加

<script type="text/javascript">
var intYear,intMonth,intDay;
var today;
today=new Date();
intYear=today.getYear();
intMonth=today.getMonth()+1;
intDay=today.getDate();
timeString=intYear+"-"+intMonth+"-"+intDay;

 if(timeString=="2010-8-15")
 {
    document.writeln("<style type=/"text/css/">");
    //document.writeln("html { filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); }");
 document.writeln("*{ filter:Gray;}");

//*可调整更多元素 例如某些弹出的客服框。
    document.writeln("</style>");
 }
</script>

二、关于网站FLASH变灰色

如果上述代码无法实现变灰色,部分FLASH无法变灰色,具体原因不详。在FLASH代码中可采用以下:

<param value="opaque" name="wmode"/>

想通过JS代码在日期时间自动调整灰色显示,未能实现效果。

 

三、简单的CSS控制

<style type="text/css">
body {
filter:Gray; 
}
</style>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值