健康体重评估
1 <script> 2 var sex = prompt("请输入性别:"); 3 var height = parseInt(prompt("请输入身高:")); 4 var weight = parseInt(prompt("请输入体重")); 5 var x, y; 6 if(sex == "男") { 7 x = height - 100 + 3; 8 y = height - 100 - 3; 9 if(weight > y && weight < x) { 10 11 alert("你的标准体重在" + y + "~" + x + "之间" + "," + "你的体重为" + weight + ",你的体重很标准!"); 12 13 } else if(weight < y) { 14 alert("你的标准体重在" + y + "~" + x + "之间" + "," + "你的体重为" + weight + ",多吃点儿,你有点儿瘦!"); 15 16 } else if(weight > x) { 17 alert("您的标准体重在" + y + "~" + x + "之间" + "," + "您的体重为" + weight + ",超过100kg你会感受到不一样的目光。"); 18 19 } 20 21 22 23 } else if(sex == "女") { 24 x = height - 110 + 3; 25 y = height - 110 - 3; 26 if(weight > y && weight < x) { 27 alert("你的标准体重在" + y + "~" + x + "之间" + "," + "你的体重为" + weight + ",你的体重很标准!"); 28 29 } else if(weight < y) { 30 alert("你的标准体重在" + y + "~" + x + "之间" + "," + "你的体重为" + weight + ",多吃点儿,你有点儿瘦!"); 31 32 } else if(weight > x) { 33 alert("您的标准体重在" + y + "~" + x + "之间" + "," + "您的体重为" + weight + ",知道你为什么没有男朋友了么。"); 34 35 } 36 } else { 37 alert("人妖,滚(ノ`Д)ノ!!!!!!!!"); 38 } 39 </script>