02_ if_else if 练习

  • <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8" />
            <title>小花的相亲</title>
        </head>
        <body>
            <script type="text/javascript">
                var manHeight = +prompt("请输入男方身高(xxcm):");
                var manMoney = +prompt("请输入男方财产(xx万):");
                var manFace = +prompt("请输入男方颜值(0-1000):");
                var girlWords;
                
                if (manHeight > 180 && manMoney > 1000 && manFace > 500 )
                {
                    girlWords = "我一定要嫁给他!";
                }
                else if (manHeight > 180 || manMoney > 1000 || manFace > 500 )
                {
                    girlWords = "嫁吧,比上不足,比下有余。";
                }
                else
                {
                    girlWords = "不嫁!";
                }
                
                alert(girlWords);
                document.write(girlWords);
            </script>
        </body>
    </html>

     

posted @ 2018-09-19 16:05  耶梦加德  阅读(134)  评论(0编辑  收藏  举报