一、以下代码可自动根据设定的日期调整颜色为灰色。可在页面<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>