网站地图    收藏   

主页 > 前端 > css教程 >

根据日期切换图片KFX - html/css语言栏目:html.css

来源:自学PHP网    时间:2015-04-14 14:51 作者: 阅读:

[导读] !DOCTYPE html PUBLIC - W3C DTD XHTML 1 0 Transitional EN http: www w3 org TR xhtml1 DTD xhtml1-transitional dtd html xmlns=http: www w3 org 1999 xhtml head meta...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
<script id="allmobilize" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>  
<title>根据日期切换图片KFX</title>  
</head>  
<body>  
  
<span id="kfx" style="display:none;"></span>  
<div id="kfx_bg" style="height:440px;background-color:red;"></div>  
<script type="text/javascript">  
function showLocale(objD)  
{  
    var str,colorhead,colorfoot;  
    var yy = objD.getYear();  
    if(yy<1900) yy = yy+1900;  
    var MM = objD.getMonth()+1;  
    if(MM<10) MM = '0' + MM;  
    var dd = objD.getDate();  
    if(dd<10) dd = '0' + dd;  
    var hh = objD.getHours();  
    if(hh<10) hh = '0' + hh;  
    var mm = objD.getMinutes();  
    if(mm<10) mm = '0' + mm;  
    var ss = objD.getSeconds();  
    if(ss<10) ss = '0' + ss;  
    var ww = objD.getDay();  
    if  ( ww==0 )  colorhead="<font color=\"#FF0000\">";  
    if  ( ww > 0 && ww < 6 )  colorhead="";  
    if  ( ww==6 )  colorhead="<font color=\"#008000\">";  
  
    colorfoot=""  
    str = colorhead+ MM + "-" + dd ;  
    return(str);  
}  
function tick()  
{  
var today;  
today = new Date();  
document.getElementById("kfx").innerHTML = showLocale(today);  
  
  
//立春2月4日  
if(showLocale(today)=="11-01"){  
  $(function(){  
  $("#kfx_bg").css("background-image","url('spring.png')");  
  //$("#kfx_bg").css("background-image","url('http://www.baidu.com/img/bdlogo.gif')");  
    
})  
}  
//立夏5月5号或6号  
else if(showLocale(today)=="05-05"){  
  $(function(){  
   $("#kfx_bg").css("background-image","url('summer.png')");  
  })  
}  
//立秋9月23日或24日  
else if(showLocale(today)=="09-23"){  
  $(function(){  
  $("#kfx_bg").css("background-image","url('autumn.png')");   
  })  
}  
//立冬11月7号  
else if(showLocale(today)=="11-07"){  
  $(function(){  
   $("#kfx_bg").css("background-image","url('winter.png')");   
  })  
}  
//五一  
else if(showLocale(today)=="05-01"){  
  $(function(){  
   $("#kfx_bg").css("background-image","url('wuyi.png')");   
  })  
}  
//国庆  
else if(showLocale(today)=="10-01"){  
  $(function(){  
   $("#kfx_bg").css("background-image","url('guoqing.png')");   
  })  
}  
  
;  
  
}  
tick();  
  
</script>  
</body>  
</html>  

 

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论