一、题目
大家都知道,男大当婚,女大当嫁。那么女方家长要嫁女儿,当然要提出一定的条件:
高:180cm以上; 富:1000万以上; 帅:500以上;
如果这三个条件同时满足,则:'我一定要嫁给他'
如果三个条件有为真的情况,则:'嫁吧,比上不足,比下有余。'
如果三个条件都不满足,则:'不嫁!'
二、代码示例
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>if练习2</title>
<script type="text/javascript">
var height = prompt("请输入男方的身高(单位:cm)");
var wealth = prompt("请输入男方的财富(单位:万)");
var handsome = prompt("请输入男方的帅气值");
if(height > 180 && wealth > 1000 && handsome > 500){
alert("我一定要嫁给他");
}else if(height > 180 || wealth > 1000 || handsome > 500){
alert("嫁吧,比上不足,比下有余。");
}else{
arlet("不嫁!");
}
</script>
</head>
<body>
</body>
</html>