第二次考试前端

来源:互联网 发布:淘宝网如何盈利模式 编辑:程序博客网 时间:2024/06/07 14:02

1.css3的过渡效果()
定义:从一种样式逐渐改变为另一种的效果;
条件:a.规定你希望把效果添加到那个css属性上;
b.规定效果的时长;
兼容性:在ie10以上;
书写格式:transition:参与属性 过渡时间 动画类型 延迟时间;
动画类型:ease:以慢速开始,然后变快,最后以慢速结束;
linear:从始到终都是相同的速度;

<!DOCTYPE html><html><head>    <style>        div        {           width:100px;           height:100px;            background:yellow;            transition:width 1s linear 2s;  //写在hover的对象;而不是写在      hover里面;            /* Firefox 4 */            -moz-transition:width 1s linear 2s;            /* Safari and Chrome */            -webkit-transition:width 1s linear 2s;            /* Opera */            -o-transition:width 1s linear 2s;        }        div:hover        {          width:500px;        }    </style></head><body><div></div><p>请把鼠标指针放到黄色的 div 元素上,来查看过渡效果。</p><p><b>注释:</b>本例在 Internet Explorer 中无效。</p><p><b>注释:</b>这个过渡效果会在开始之前等待两秒。</p></body></html>

定义函数的两种方式

<!doctype html><html lang="en"><head>    <meta charset="UTF-8">    <title>Document</title></head><body></body><script>    /*定义函数的方式有两种方式    * 1.function funname(形参){    * 函数体                         函数声明方式    * }    * 调用函数:funname(实参)    * 2.var funname=function(形参){    * }                                自调用匿名函数    * funname(实参);    *    * */    aa();    function aa(){        console.log(111);    }    var bb=function(){        console.log(222);    };    bb();    (function(){        console.log(333);    //不加上一个圆括号,此时就不是一个表达式;    })();    !function(){              //!一个字符压缩 节约内存        console.log(444);    }();</script></html>

var num1=10,num2=20;
var num=”num1+num2=”+num1*num2;
var num3=”num1+num2=”+num1+num2;
console.log(num3); //num1+num2=1020
console.log(num); //num1+num2=200;
var arr=[111,222,333,444];
arr.forEach(function(item,index){
console.log(item,index); //111 0; 222 1; 333 2; 444 3;
});

原始对象                                    原始数据值string('eeee')                             'eee'boolean('true')                            true;number('111111')                           11111;valueof()是获取原始对象的原始数据值;tostring()是将原始对象强制转换为原始字符串;

var bool=new Boolean(‘true’);
console.log(bool.valueOf());
console.log(bool.toString());
var str=new String(‘1111’);
console.log(str.valueOf());

“`

src:串行执行;具有阻塞后面代码的作用,前面代码错误,后面就不能执行;
href:并行执行 互相不影响