腦友記廣場 -> 新手上路 -> 這個如何寫好? 登錄 -> 註冊 -> 回復主題 -> 發表主題

stdy 2006-10-25 01:55
請問如果想在本人網頁中, 每日的圖片都與加菲的網站同樣更新, 應該如何寫好???

即是



中的圖片名稱ga061025.gif都是按每日更新, 應如何是好??

maninnet 2006-10-26 05:54
<html>
<body>

<script language="javascript">
var startDate = new Date()
var theDay = startDate.getUTCDate()
var theMonth = startDate.getMonth() + 1
var theYear = startDate.getFullYear()
var dirYear = theYear - 2000

if (theDay.toString().length==1)
{
theDay = "0" + theDay
}
if (theMonth.toString().length==1)
{
theMonth = "0" + theMonth
}
if (dirYear.toString().length==1)
{
dirYear = "0" + dirYear
}

document.write("<img src=http://images.ucomics.com/comics/ga/"+theYear+"/ga"+dirYear+theMonth+theDay+".gif>")

</script>

</body>
</html>

stdy 2008-11-10 01:45
thx alot!! 太耐冇上番來~ 一上來就見有高人指導~ 正!

matfu 2008-11-15 22:17
var theMonth = startDate.getMonth() + 1
咁12月會唔會err 嫁

scng71 2008-11-22 05:11
唯有慢慢學習了


查看完整版本: [-- 這個如何寫好? --] [-- top --]


Powered by PHPWind v4.0.1 Code © 2003-05 PHPWind
Gzip enabled

You can contact us