美文网首页
2018-12-01

2018-12-01

作者: 11bbc2c5d0c6 | 来源:发表于2018-12-01 16:31 被阅读0次
练习题1
<html lang="en">
<head>
<meta charset="UTF-8">
<title>小明</title>
<script type="text/javascript">
    var score = prompt('请输入小明的期末成绩(0-100):');
        if (score == 100){
            alert('BMW');
        }else if (score >=80 && score <=99){
            alert('iphone15s');
        }else if (score >=60 && score < 80){
            alert('参考书');
        }else {
            alert('啥也没有')
        }
</script>
</head>
<body>

</body>
</html>
练习题2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>嫁女儿</title>
<script type="text/javascript">
    var H = 180, M = 10000000, F = 500;
        if (H >= 180 && M >= 10000000 && F >= 500){
            alert('我一定要嫁给他');
        }else if (H >= 180 || M >= 10000000 || F >= 500){
            alert('嫁吧,比上不足,比下有余');
        }else {
            alert('不嫁');
        }
</script>
</head>
<body>

</body>
</html>
练习题3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>排序</title>
<script type="text/javascript">
    var num1 = prompt('请输入一个整数');
    var num2 = prompt('请输入一个整数');
    var num3 = prompt('请输入一个整数');
    var a;
        if (num1 > num2 && num2 > num3){
            a = String(num3) + num2 + num1;
            alert(a);
        }else if (num1 < num2 && num2 < num3){
            a = String(num1) + num2 + num3;
            alert(a);
        }else if(num1 < num2 && num2 > num3 && num1 > num3){
            a = String(num3) + num1 + num2;
            alert(a);
        }else if(num1 < num2 && num2 > num3 && num1 < num3){
            a = String(num1) + num3 + num2;
            alert(a);
        }else if(num1 > num2 && num2 < num3 && num1 > num3){
            a = String(num2) + num3 + num1;
            alert(a);
        }else if(num1 > num2 && num2 < num3 && num1 < num3) {
            a = String(num2) + num1 + num3;
            alert(a);
        }
</script>
</head>
<body>

</body>
</html>

相关文章

网友评论

      本文标题:2018-12-01

      本文链接:https://www.haomeiwen.com/subject/exrrcqtx.html