<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>if...else</title>
<script type="text/JavaScript">
function zz(){
var myage;
myage =prompt("你的年龄")
if(myage<=44)
{document.write("青年");}
else if(myage<=59)
{document.write("中年人");}
else if (myage<=89)
{document.write("老年人");}
else
{document.write("长寿老年人");}
else{document.write("永远十八");}
}
</script>
</head>
<body>
<from>
<input type="button" value="点次测试年龄段" onclick="zz()">
</from>
</body>
</html>