• js的一些应用技巧


    1.保持layer在最前面,而不被Iframe、Object所覆盖
     在Layer中再插Iframe 或 Object 设z-Index值
     <div z-Index:2><object xxx></object> #前面
     <div z-Index:1><object xxx></object> #后面
     <div id="Layer2" style="position:absolute; top:40;400px;
     height:95px;z-index:2"> height=100% width=100%>
     <iframe width=0 height=0></iframe>
     </div>
     <div id="Layer1" style="position:absolute; top:50;200px;
     height:115px;z-index:1">
     <iframe height=100% width=100%></iframe> 字串6
     </div>

    2. 取得控件的绝对位置
    //javascript
    <script language="javascript">
    function getIE(e){
    var t=e.offsetTop;
    var l=e.offsetLeft;
    while(e=e.offsetParent){
    t+=e.offsetTop;
    l+=e.offsetLeft;
    }
    alert("top="+t+"/nleft="+l);
    }
    </script>

       GetNowObjectPosition: function(a){
            this.obj = a;
            var b = a.offsetLeft;
            var c = a.offsetTop;
            var d = a.offsetParent;
            while (d != null) {
                if (d.tagName != "BODY") {
                    b += d.offsetLeft;
                    c += d.offsetTop;
                    d = d.offsetParent
                }
                else {
                    b += document.body.offsetLeft || 0;
                    c += document.body.offsetTop || 0;
                    break
                }
            }
            return {
                X: b,
                Y: c
            }
        },

               var c = MyUtility.GetNowObjectPosition(objPlaceID);
                newMask.style.top = c.Y + "px";
                newMask.style.left = c.X + "px";

     3.脚本永不出错
    <SCRIPT LANGUAGE="javascript">
    <!-- Hide
    function killErrors() {
    return true;
    }
    window.onerror = killErrors;
    // -->
    </SCRIPT>


     

  • 相关阅读:
    部分Gamefest 2011的材料已经放出
    glloader 3.7.0发布,支持最新的OpenGL 4.2
    关于D3D11,你必须了解的几件事情(二)
    不争气的geometry shader
    day2:数据类型、字符编码、文件处理
    jquery 常用
    Eclipse插件开发之EasyExplorer
    如何切图&PS切图&网页切图
    PS切图的相关技巧
    Eclipse快捷键大全(转载)
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1597177.html
Copyright © 2020-2023  润新知