根据出生日期,求星座。
<html>
<head>
<title>
欢迎
</title>
<script language="JavaScript">
function show()
{
date=document.getElementById("txtDay").value;
month=document.getElementById("txtMonth").value;
if (month == 1 && date >=20 || month == 2 && date <=18) {alert("水瓶座");}
if (month == 2 && date >=19 || month == 3 && date <=20) {alert( "双鱼座");}
if (month == 3 && date >=21 || month == 4 && date <=19) {alert("白羊座");}
if (month == 4 && date >=20 || month == 5 && date <=20) {alert ("金牛座");}
if (month == 5 && date >=21 || month == 6 && date <=21) {alert( "双子座");}
if (month == 6 && date >=22 || month == 7 && date <=22) {alert ("巨蟹座");}
if (month == 7 && date >=23 || month == 8 && date <=22) {alert( "狮子座");}
if (month == 8 && date >=23 || month == 9 && date <=22) {alert( "室女座");}
if (month == 9 && date >=23 || month == 10 && date <=22) {alert( "天秤座");}
if (month == 10 && date >=23 || month == 11 && date <=21) {alert( "天蝎座");}
if (month == 11 && date >=22 || month == 12 && date <=21) {alert( "人马座");}
if (month == 12 && date >=22 || month == 1 && date <=19) {alert("摩羯座");}
}
</script>
</head>
<body>
请入你的出生日期:<br>
月<input type="text" name="txtMonth"/><br>
日<input type="text" name="txtDay"/><br>
<input type="button" onclick="show()" value="计算"/><br>
</body>
</html>
这是代码,没人吗,我用了两个text文本框,一个输入月 一个输入日,然后把月,和日,转换成变量month和date,可出不来结果啊
<head>
<title>
欢迎
</title>
<script language="JavaScript">
function show()
{
date=document.getElementById("txtDay").value;
month=document.getElementById("txtMonth").value;
if (month == 1 && date >=20 || month == 2 && date <=18) {alert("水瓶座");}
if (month == 2 && date >=19 || month == 3 && date <=20) {alert( "双鱼座");}
if (month == 3 && date >=21 || month == 4 && date <=19) {alert("白羊座");}
if (month == 4 && date >=20 || month == 5 && date <=20) {alert ("金牛座");}
if (month == 5 && date >=21 || month == 6 && date <=21) {alert( "双子座");}
if (month == 6 && date >=22 || month == 7 && date <=22) {alert ("巨蟹座");}
if (month == 7 && date >=23 || month == 8 && date <=22) {alert( "狮子座");}
if (month == 8 && date >=23 || month == 9 && date <=22) {alert( "室女座");}
if (month == 9 && date >=23 || month == 10 && date <=22) {alert( "天秤座");}
if (month == 10 && date >=23 || month == 11 && date <=21) {alert( "天蝎座");}
if (month == 11 && date >=22 || month == 12 && date <=21) {alert( "人马座");}
if (month == 12 && date >=22 || month == 1 && date <=19) {alert("摩羯座");}
}
</script>
</head>
<body>
请入你的出生日期:<br>
月<input type="text" name="txtMonth"/><br>
日<input type="text" name="txtDay"/><br>
<input type="button" onclick="show()" value="计算"/><br>
</body>
</html>
这是代码,没人吗,我用了两个text文本框,一个输入月 一个输入日,然后把月,和日,转换成变量month和date,可出不来结果啊
...全文
相关推荐
sql存储过程根据生日求星座修正
sql存储过程根据生日求星座修正sql存储过程根据生日求星座修正
php 根据出生日月判断星座
前言 注意:由于此函数使用了 each() 函数,故不支持 PHP7+ 环境下运行。 该函数用于判断星座,通过传入日月参数来完成判断,语法如下。 getConstellation($month, $day) $month:月(number) $day:日(number) code 函数只完成了运算,并没有做太多参数判断及约束。 function getConstellation($mon...
sql存储过程根据生日求星座
sql存储过程根据生日求星座sql存储过程根据生日求星座
Android通过出生日期确定星座及年龄
通过出生月份和日期来确定星座及年龄,项目中用到了书写了一个工具类。
根据出生日期获取星座和生肖,农历等信息
这个里面是c#源码,有根据出生日期得到星座和生肖以及农历详细信息等


Web 开发
