Blogger Information
Blog 77
fans 0
comment 0
visits 55244
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
JavaScript基础作业练习_1022
Jet的博客
Original
593 people have browsed it
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        /*
                                                                                                                                function func() {
                                                                                                                                    var a = 123;
                                                                                                                                    alert(a);
                                                                                                                                    return 'abc';
                                                                                                                                }
                                                                                                                                alert(func());
                                                                                                                                */
        /*
                var score = 90;
                if (score < 60) {
                    alert('不及格');
                }
                if (score >= 60 && score < 80) {
                    alert('良好');
                }
                if (score >= 80 && score < 90) {
                    alert('不错哦');
                }
                if (score >= 90 && score < 100) {
                    alert('优秀');
                }
        */
        /*
                var num = 6;
                for (i = 0; i < num; i++) {
                    alert('i=' + i);
                }

                var num = 1;
                while (num < 6) {
                    alert('num=' + num);
                    num++;
                }

                var num = 6;
                while (num > 6) {
                    alert('num=' + num);
                }
        */
        /*
        var num = 'asd';
        num = parseInt(num);
        //parseInt 转换为整型
        alert(typeof(num));
        if (isNaN(num)) {
            alert('转换失败');
        }
        if (isNumber(num)) {
            alert(num);
        }
        */
        /*
        var arr = [1, 2, 3, 5, 6];
        //不建议插入数据
        //arr[9] = 44;
        //往数组后面插入数据
        arr.push(44);
        alert('长度是' + arr.length);
        //弹出尾部元素
        var res = arr.pop();
        alert(res);
        console.log(arr);
        alert('长度是' + arr.length);
        */

        //var arr = [1, 2, 3, 5, 6];
        //在第一个位置添加一个元素
        //arr.unshift('abc');
        //删除第一个元素
        //var res = arr.shift();
        //alert(res);
        //console.log(arr);

        var arr = [1, 2, 3, 4, 5, 6];
        //从第几个元素开始删除几个元素
        //var res = arr.splice(2, 4);
        //console.log(res);
        //搜索目标元素,第几个元素开始找;返回改数据索引
        //var res = arr.indexOf(5, 0);
        //alert(res);
        //console.log(arr);

        //数组遍历
        // for (i = 0; i < arr.length; i++) {
        //     console.log(arr[i]);
        // }

        // var i = 0;
        // while (i < arr.length) {
        //     console.log(arr[i]);
        //     i++;
        // }
        function over() {
            console.log('鼠标滑过了');
        }

        function out() {
            console.log('鼠标划走了');
        }
    </script>
</head>

<body>
    <div style="background-color: aqua; width: 200px; height: 80px;" onmouseover="over()" onmouseout="out()"></div>
</body>

</html>

Correction status:qualified

Teacher's comments:基本语法并不多, 与php差不多
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post