用就javascript脚本语言设计程序

时间:2014-04-02 21:01:26   收藏:0   阅读:651

        根据当天是星期几,在页面中显示不同的图片。

        源代码:

        <!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" />
          <title>日历</title>
</head>
 <body>
     <script language="javascript">
         var today=new Date();
    t=today.getDay();
    if(t==1)
    document.write("今天是星期一<p><img src=1.jpg>");
    if(t==2)
    document.write("今天是星期二<p><img src=2.jpg>");
    if(t==3)
    document.write("今天是星期三<p><img src=3.jpg>");
    if(t==4)
    document.write("今天是星期四<p><img src=4.jpg>");
    if(t==5)
    document.write("今天是星期五<p><img src=5.jpg>");
    if(t==6)
    document.write("今天是星期六<p><img src=6.jpg>");
    if(t==0)
    document.write("今天是星期日<p><img src=0.jpg>");
      </script>   
    </body>
</html>

用就javascript脚本语言设计程序,布布扣,bubuko.com

原文:http://8435973.blog.51cto.com/8425973/1389252

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!