| 项目搜索 |
| |
|
代码片段库:
查看代码片段
浏览
| 提交新的代码片段
| 创建代码包
用图片显示日期
|
类型:
Full Script |
类别:
HTML Manipulation
|
许可证:
GNU General Public License |
语言:
JavaScript
|
描述:
用图片显示日期,原理不烦,但是很有意思,而且图片也漂亮
|
该代码片段的版本系列:
片段ID |
下载版本 |
提交时间 |
提交人 |
删除 |
4721 | 1.0 | 2003-10-14 16:42 | cbd001 | |
点击"下载版本"来下载该代码片段.
最新版本的代码片段: 1.0
脚本说明:
把如下代码加入<body>区域中:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
theDate= new Date();
months = new Array();
days = new Array();
months[1] ="jan.gif";
months[2] ="feb.gif";
months[3] ="mar.gif";
months[4] ="apr.gif";
months[5] ="may.gif";
months[6] ="jun.gif";
months[7] ="jul.gif";
months[8] ="aug.gif";
months[9] ="sep.gif";
months[10] ="oct.gif";
months[11] ="nov.gif";
months[12] ="dec.gif";
days[1] ="1st.gif";
days[2] ="2nd.gif";
days[3] ="3rd.gif";
days[4] ="4th.gif";
days[5] ="5th.gif";
days[6] ="6th.gif";
days[7] ="7th.gif";
days[8] ="8th.gif";
days[9] ="9th.gif";
days[10] ="10th.gif";
days[11] ="11th.gif";
days[12] ="12th.gif";
days[13] ="13th.gif";
days[14] ="14th.gif";
days[15] ="15th.gif";
days[16] ="16th.gif";
days[17] ="17th.gif";
days[18] ="18th.gif";
days[19] ="18th.gif";
days[20] ="20th.gif";
days[21] ="21st.gif";
days[22] ="22nd.gif";
days[23] ="23rd.gif";
days[24] ="24th.gif";
days[25] ="25th.gif";
days[26] ="26th.gif";
days[27] ="27th.gif";
days[28] ="28th.gif";
days[29] ="29th.gif";
days[30] ="30th.gif";
days[31] ="31st.gif";
function printDate() {
document.write('<img src="' + months[theDate.getMonth()+1] + '">'); // month
document.write('<br>');
document.write('<img src="' + days[theDate.getDate()] + '">'); // day
}
// End -->
</script>
<script>
printDate();
</script>
如果您修改了一个代码片段并且觉得很应该让别人共享,您可以把这作为这个代码片段的最新版本提交上来. |
|