9月20日测验总结

  • 选择器权重

    !important > style行间 > id > class > 属性 > 标签 > * > 继承

  • BFC规范
    • BFC规范:可以形成一个独立的容器。不受到外界的影响,从而解决一些布局问题。
    • 触发条件:
      float 除 none 以外的值
      position 值为 absolute 或 fixed
      display 值为 inline-block, table-cells, flex
      overflow 除了 visible 以外的值
  • 只用一条CSS代码表示浏览器一半的宽度
    • vw : viewpoint width,视窗宽度,1vw=视窗宽度的1%
    • vh : viewpoint height,视窗高度,1vh=视窗高度的1%
    • 所以浏览器一半的高度可表示为 50vh
  • input :readonly和disable
    • readonly: 属性规定输入字段是只读的。
      只读字段是不能修改的。不过,还可以选中或拷贝其文本。
    • disable: disabled 属性规定应该禁用的 input元素。
      被禁用的 input 元素是无法使用和无法点击的。
      :表单中被禁用的 input元素不会被提交。
  • transform
    • translate : 位移
    • scale :放缩(值为比例)
    • rotate:旋转(单位为deg,正为顺时针旋转,负为逆时针旋转)
    • skew : 斜切(单位为deg,正为向左倾斜,负为向右倾斜)
  • 阻止冒泡和默认事件的方法
    • 阻止冒泡
      • e.stopPropagation W3C标准
      • e.cancelBubble = true 非标准,IE6,7,8
    • 阻止默认事件
      • preventDefault() 标准
      • e.returnValue=false 非标准,IE6,7,8
  • 获取DOM元素的方法
    • ID : document.getElementById(‘id’)
    • 标签名 :document.getElementsByTagName(‘类名’)
    • H5新增方法:
      • document.getElementsByClassName(‘类名’)
      • document.querySelector(‘选择器’)
      • document.querySelectorAll(‘选择器’)
    • 获取特殊元素(body, html)
      • body : document.body
      • html : document.documentElement
  • Get和post的区别
    • GET - 从指定的资源请求数据。
      GET 请求可被缓存
      GET 请求保留在浏览器历史记录中
      GET 请求可被收藏为书签
      GET 请求有长度限制
      GET 请求不应在处理敏感数据时使用
      GET 请求只应当用于取回数据
    • POST - 向指定的资源提交要被处理的数据。
      POST 请求不会被缓存
      POST 请求不会保留在浏览器历史记录中
      POST 不能被收藏为书签
      POST 请求对数据长度没有要求
  • HTTP状态码

    1XX 信息性状态码(Informational) 服务器正在处理请求
    2XX 成功状态码(Success) 请求已正常处理完毕(请求成功)
    3XX 重定向状态码(Redirection) 需要进行额外操作以完成请求
    4XX 客户端错误状态码(Client Error) 客户端原因导致服务器无法处理请求
    5XX 服务器错误状态码(Server Error) 服务器原因导致处理请求出错

  • 用js递归的方式写1到100求和
      	function add(var max)
      	{   
      		 if (max>1)
      		 	return max+add(max-1);
      		 else
      		 	return 1;
      	}
    
  • 写出下列打印的值
      function fn(a){
          console.log(a);             
          var a = 123;
          console.log(a);             
          function a(){};
          console.log(a);             
          var b = function(){};
          console.log(b);             
          function c(){};
      }
      fn(1);
      // 变量和函数提升后:
      function fn(a){
         	var a;
            function a(){};
              var b;
              function c(){};
      	    console.log(a);             // ƒ a(){}
      	    a = 123;
      	    console.log(a);            // 123
      	    console.log(a);             // 123
      	    b = function(){};
      	    console.log(b);               // ƒ (){}
      }
      fn(1);
    
  • 写出下列函数的 i 的返回值
    function  createFunctions() {
    var result = new Array();
    
          for (var i = 0;i<10;i++){
              result[i] = function () {
                  return i;
              }
          }
        return result;
      }   
    

闭包问题,当定义完所有的result函数时,i 的值已经变为了10,当引用result 函数时,返回的i 值就为10,所以会返回10个10

  • 写出下列结果
      var a = [34,4,3,54],
          b = 34,
          c = 'adsfas',
          d = function(){console.log('我是函数')},
          e = true,
          f = null,
          g;
      
       console.log(typeof(a));          // object           
       console.log(typeof(b));          // number           
       console.log(typeof(c));          // string  
       console.log(typeof(d));          // function          
       console.log(typeof(e));          // boolean           
       console.log(typeof(f));           // object          
       console.log(typeof(g));          // undefined          
       console.log(typeof(j));           // undefined           
       alert(h);            // 报错
    
  • 以下代码的结果是
          var a = 10; 
      	var b = 20; 
      	var c = 10;
      	alert(a = b);          // 20  相当于把b的值赋给a, 并输出a
      	alert(a == b);		// true
      	alert(a == c);		// false
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值