惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News - Newest:
Hacker News - Newest: "LLM"
U
Unit 42
爱范儿
爱范儿
博客园_首页
量子位
S
SegmentFault 最新的问题
IT之家
IT之家
T
Tailwind CSS Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
小众软件
小众软件
AWS News Blog
AWS News Blog
T
The Exploit Database - CXSecurity.com
C
Cyber Attacks, Cyber Crime and Cyber Security
L
Lohrmann on Cybersecurity
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cyberwarzone
Cyberwarzone
博客园 - 【当耐特】
Latest news
Latest news
Security Latest
Security Latest
T
Tor Project blog
I
Intezer
P
Privacy & Cybersecurity Law Blog
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
The Cloudflare Blog
P
Privacy International News Feed
WordPress大学
WordPress大学
V
Vulnerabilities – Threatpost
P
Palo Alto Networks Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
GRAHAM CLULEY
Hacker News: Ask HN
Hacker News: Ask HN
月光博客
月光博客
C
CXSECURITY Database RSS Feed - CXSecurity.com
Last Week in AI
Last Week in AI
N
News and Events Feed by Topic
Jina AI
Jina AI
V
V2EX
S
Securelist

博客园 - KenBlove

错误代码:0x800706BE 解决方法 泛微OA服务器更改IP地址后EMobile出现“调用远端服务器接口时发生错误(122)”的提示 HTTP 错误 404 - 文件或目录未找到 HTTP 错误 401.2 - 未经授权:访问由于服务器配置被拒绝。 优雅还不够,简洁才高效!——用NValidator一句话搞定客户端检测 MyXls初级教程 一个仿PetShop的通用DBHelper类 纯CSS实现底部固定漂浮导航 Access和SQL server开启表间关系,并实现更新或删除母表数据自动更新或删除子表数据 来自微软关于异常处理的17条军规 SQL Server Profiler过滤本机信息的办法 "The state information is invalid for this page and might be corrupted"错误的一个解决办法 SQL回滚Transaction来调试SQL语句 SQL找出和删除一个表的重复记录 SQL常用判断检测语句 SQL把ID相同的记录合并成同一条记录 从丑陋到优雅,让代码越变越美续集之服务器端数据校验 关于FireFox记住密码后出现的bug 关于Iframe在IE6下不显示的bug 从丑陋到优雅,让代码越变越美(客户端检测方法思考)
一个简单的拖动层(兼容IE,FF)
KenBlove · 2009-06-05 · via 博客园 - KenBlove

Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    
<title>拖动层</title>
    
<style type="text/css">
    .main
    
{
        position
: absolute; 
        background-color
: #fff;
        top
: 100px; 
        left
: 100px; 
        z-index
: 101; 
        border
: solid 1px #ccc;
    
}
    .titlebar
    
{
        background-color
: #ccc; 
        cursor
: move; 
        height
: 20px; 
        color
: #fff;
        font-size
: 13px; 
        padding-top
: 5px; 
        padding-left
: 10px;
    
}
    
</style>
</head>
<body>
    
<div id="main" class="main" style="width: 500px; height: 350px;">
        
<div id="titlebar" class="titlebar">
            拖动层
        
</div>
        
<div id="Div1" class="main" style="width: 200px; height: 50px;">
            
<div id="Div2" class="titlebar">
                拖动层2
            
</div>
        
</div>
    
</div><script type="text/javascript">
        
new drag("main""titlebar");
        
new drag("Div1""Div2");function drag(main, titlebar) {
            
var obj = document.getElementById(main);
            
var title = document.getElementById(titlebar);
            
if(obj && title)
            {            
                
var posX;
                
var posY;
                
var offset = 10;
                
var mousemove = function(evt) {
                    
if (evt == null) evt = window.event;
                    
var left = evt.clientX - posX;
                    
var top = evt.clientY - posY;
                    
var limitLeft = 0;
                    
var limitTop = 0;
                    
if(obj.parentNode.nodeName != "BODY")
                    {
                        limitLeft 
= obj.parentNode.clientWidth - obj.clientWidth - offset;
                        
if(limitLeft < left)
                        {
                            left 
= limitLeft;
                        }
                        limitTop 
= obj.parentNode.clientHeight - obj.clientHeight - offset;
                        
if(limitTop < top)
                        {
                            top 
= limitTop;
                        }
                    }
                    
else
                    {
                        limitLeft 
= window.screen.availWidth - obj.clientWidth - offset;
                        
if(limitLeft < left)
                        {
                            left 
= limitLeft;
                        }
                        limitTop 
= window.screen.availHeight - obj.clientHeight - offset;
                        
if(limitTop < top)
                        {
                            top 
= limitTop;
                        }
                    }
                    
if(left < offset)
                    {
                        left 
= offset;
                    }
                    
if(top < offset)
                    {
                        top 
= offset;
                    }
                    obj.style.left 
= left + "px";
                    obj.style.top 
= top + "px";
                }
                
                title.onmousedown 
= function(evt) {
                    
if (!evt) evt = window.event;
                    posX 
= evt.clientX - obj.offsetLeft;
                    posY 
= evt.clientY - obj.offsetTop;
                    document.onmousemove 
= mousemove;
                }

                document.onmouseup 

= function() {
                    document.onmousemove 
= null;
                }
            }
            
else
            {
                alert(
"参数错误!");
            }
        }
    
</script></body>
</html>