‹‹ 上一主題 打印 下一主題 ›› 生日倒數語法

 

lilian1234

金牌會員
Rank: 6Rank: 6

CraZz!e L!L

帖子
275 
積分
2172 
金錢
1377  

發表於 07-8-6 20:05 | 1樓 TOP 只看該作者

生日倒數語法


生日倒數"=]]]
在CUSTOM HEADER OR WEBSITE STATS



<!-- begin code provided by createblog.com -->
<!-- begin code provided by createblog.com -->
</tr><script language="JavaScript1.2">

var today = new Date;
var Future0 = new Date;

var BirthMonth = 6;
var BirthDate = 20;
var BirthYear = 1987;
BirthMonth--;

Future0.setMonth(BirthMonth, BirthDate);
if (Date.parse(today) > Date.parse(Future0))
{
Future0.setFullYear(today.getYear()+1);
age = (today.getYear() - BirthYear) + 1;
}
else
{age = today.getYear() - BirthYear;}

if (age % 10 == 0)
ageend = 'th';
else if (age % 10 == 4)
ageend = 'th';
else if (age % 10 == 5)
ageend = 'th';
else if (age % 10 == 6)
ageend = 'th';
else if (age % 10 == 7)
ageend = 'th';
else if (age % 10 == 8)
ageend = 'th';
else if (age % 10 == 9)
ageend = 'th';
else if (age % 10 == 1)
ageend = 'st';
else if (age % 10 == 2)
ageend = 'nd';
else if (age % 10 == 3)
ageend = 'rd';


var faraevent = "<font color=#99CC33><i>my birthday</font>";

today1 = Date.parse(today);
future1 = Date.parse(Future0);
secleft = future1 - today1;
miliday = 24 * 60 * 60 * 1000;
daysleft = secleft/miliday;
daysleftint = Math.round(daysleft);

if (daysleftint > 1)
document.write(" ", daysleftint, " days until <font color=#99CC33>my <i>", age, ageend, "</i> birthday</font>");
else if (daysleftint == 1)
document.write("<font color=#99CC33>my <i>", age, ageend, "</i> birthday</font> is tomorrow");
else if (today1 == future1)
document.write("<font color=#99CC33>my <i>", age, ageend, "</i> birthday</font> is today");
else
document.write("passed");
</script><br>
<!-- end code provided by createblog.com -->
<!-- end code provided by createblog.com -->
本帖最近評分記錄
 
 
 

牙CA

版主(CA*)
Rank: 7Rank: 7Rank: 7

板主

帖子
5665 
積分
14114 
金錢
6279  

發表於 07-8-9 22:30 | 2樓 TOP 只看該作者
幾有用, 加分 ;)
 
 
 
蔣雅文 *V*