zoukankan      html  css  js  c++  java
  • 5.13兼容性写法复习总结

    //获取屏幕可视区域的宽高(仿jQuery)
    function client(){
    if(window.innerHeight !== undefined){
    return {
    "width": window.innerWidth,
    "height": window.innerHeight
    }
    }else if(document.compatMode === "CSS1Compat"){
    return {
    "width": document.documentElement.clientWidth,
    "height": document.documentElement.clientHeight
    }
    }else{
    return {
    "width": document.body.clientWidth,
    "height": document.body.clientHeight
    }
    }
    }
    
    
    //阻止时间冒泡
    var box = document.getElementById("box");
    box.onmouseover = function (event) {
    console.log("鼠标放到了box上");
    //阻止冒泡
    event = event || window.event;

    if(event && event.stopPropagation){
    event.stopPropagation();
    }else{
    event.cancelBubble = true;
    }
    }
    
    
    //捕获时间对象(兼容性写法)
    box.onclick=function(event){
    event=event=||window.event;
    var aaa=event.target?event.target:event.srcElement;
    }
    
    
  • 相关阅读:
    hdoj_1556Color the ball
    wchar_t与char转换(总结)
    算法艺术——网络最大流
    poj_3268Silver Cow Party
    poj_2352Stars
    BellmanFord模板
    saas模式
    什么是管道
    什么是CMMI
    saas模式
  • 原文地址:https://www.cnblogs.com/vzaiBoke/p/9032144.html
Copyright © 2011-2022 走看看