手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >js根据日期判断星座的示例代码
js根据日期判断星座的示例代码
摘要:复制代码代码如下:functionxingzuo(){varstart=1901,date=document.getElementById(...

复制代码 代码如下:

function xingzuo() {

var start = 1901, date=document.getElementById("txtDay").value, month=document.getElementById("txtMonth").value;;

with (document.getElementById("txtXZ")){

if (month == 1 && date >=20 || month == 2 && date <=18) {value = "水瓶座";}

if (month == 1 && date > 31) {value = "Huh?";}

if (month == 2 && date >=19 || month == 3 && date <=20) {value = "双鱼座";}

if (month == 2 && date > 29) {value = "Say what?";}

if (month == 3 && date >=21 || month == 4 && date <=19) {value = "白羊座";}

if (month == 3 && date > 31) {value = "OK. Whatever.";}

if (month == 4 && date >=20 || month == 5 && date <=20) {value = "金牛座";}

if (month == 4 && date > 30) {value = "I'm soooo sorry!";}

if (month == 5 && date >=21 || month == 6 && date <=21) {value = "双子座";}

if (month == 5 && date > 31) {value = "Umm ... no.";}

if (month == 6 && date >=22 || month == 7 && date <=22) {value = "巨蟹座";}

if (month == 6 && date > 30) {value = "Sorry.";}

if (month == 7 && date >=23 || month == 8 && date <=22) {value = "狮子座";}

if (month == 7 && date > 31) {value = "Excuse me?";}

if (month == 8 && date >=23 || month == 9 && date <=22) {value = "室女座";}

if (month == 8 && date > 31) {value = "Yeah. Right.";}

if (month == 9 && date >=23 || month == 10 && date <=22) {value = "天秤座";}

if (month == 9 && date > 30) {value = "Try Again.";}

if (month == 10 && date >=23 || month == 11 && date <=21) {value = "天蝎座";}

if (month == 10 && date > 31) {value = "Forget it!";}

if (month == 11 && date >=22 || month == 12 && date <=21) {value = "人马座";}

if (month == 11 && date > 30) {value = "Invalid Date";}

if (month == 12 && date >=22 || month == 1 && date <=19) {value = "摩羯座";}

if (month == 12 && date > 31) {value = "No way!";}

}

}

【js根据日期判断星座的示例代码】相关文章:

js实现异步循环实现代码

js实现字符串转日期格式的方法

日历-指定日期的新闻

jquery实现的判断倒计时是否结束代码

根据分辨率不同,调用不同的css文件

必须点击广告才能进入的代码

jQuery实现div随意拖动的实例代码(通用代码)

网页里控制图片大小的相关代码

获取阴历(农历)和当前日期的js代码

根据内容自动调整弹出窗口大小的JS解决方案

精品推荐
分类导航