当前位置:编程学习 > C#/ASP.NET >>

求像QQ空间那样能够通过后台拖动设置页面摆放,来控制前台显示样式的案例或解决办法?

实现语言:ASP.NET
---
求像QQ空间那样能够通过后台拖动设置页面摆放,来控制前台显示样式的案例或解决办法?
---
最好能够多用户的~
---
谢谢~~~ --------------------编程问答-------------------- webPart能否通过后台摆放位置并保存,前台显示~ --------------------编程问答--------------------

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DragTheDIV</title>
</head>

<body>
<div id="d1" style="position:absolute;background:#eeeeee;top:20px;left:30px;width:200px;height:200px;">
    <div id="title" style="position:relative;top:0px;left:0px;width:100%;height:30px;background:#ccddee;">标题栏</div>
</div>

<div id="d2" style="position:absolute;background:#dddddd;top:50px;left:50px;width:300px;height:300px;">拖我吧</div>

 

<script language="javascript" type="text/javascript">
/*writer:solidluck(西水爱大家)
QQ:45671948----UC:75853187
Version:Beta 1.0
*/
var Browser = {
    /*@cc_on
    isIE : true,
    @*/
    isFF : window.navigator.appName.indexOf("Netscape") != -1 ? true : false
};
if(Browser.isIE)
{
    var HTMLElement        = new Function();
    var HTMLDivElement     = new Function();
    var HTMLUnknownElement = new Function();
}

function $()
{
    if(!arguments.length) return;
    var elements = [];
    for(var i = 0;i < arguments.length;i++)
    {
        elements.push(document.getElementById(arguments[i]));
        if(Browser.isIE)
        {
            if(!elements[i].expand)
            {
                Global.copy(elements[i],HTMLElement.prototype);
                Global.copy(elements[i],elements[i].getType().prototype);
                elements[i].expand = true;
            }
        }
    }
    if(elements.length == 1) return elements[0];
    return elements;
}
var Global = {
    copy : function(without,object)
    {
        if(arguments.length != 2) return;
        if(!without || !object) return;
        for(var index in object)
        {
            if(without[index]) continue;
            without[index]=object[index];
        }
    }
}
Global.copy(HTMLElement.prototype,{
    getType : function()
    {
        if(this.tagName.toUpperCase() != "DIV") return HTMLUnknownElement;
        return HTMLDivElement;
    }
});
Global.copy(HTMLDivElement.prototype,{
    parent : function()
    {
        var Parent = this.offsetParent,current;
        if(Parent.tagName.toUpperCase() == "BODY" || Parent.tagName.toUpperCase() == "HTML")
        {
            current = this;
        }
        else
        {
            current = Parent;
        }
        return current;
    },
    drag : function()
    {
        var _this = this.parent();
        var current = this;
        var doc = document.documentElement || document.body;
        this.runtimeStyle.cursor = "move";
        function down(e)
        {
            Global.down = true;
            Global.left = event.clientX - _this.offsetLeft;
            Global.top = event.clientY - _this.offsetTop;
            if(_this.setCaptrue) _this.setCaptrue();
            else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
            document.body.onmousemove = function(e)
            {
                if(Global.down)
                {
                    _this.runtimeStyle.left = Math.min(Math.max((event.clientX - Global.left),0),doc.clientWidth - _this.clientWidth) + "px";
                    _this.runtimeStyle.top = Math.min(Math.max((event.clientY - Global.top),0),doc.clientHeight - _this.clientHeight) + "px";
                }
                return false;
            }
            document.body.onmouseup = function(e)
            {
                Global.down = false;
                if(_this.releaseCapture) _this.releaseCapture();
                else if(window.releaseEvents) window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
                document.onmousemove = null;
                document.onmouseup = null;
                return false;
            }
            return false;
        }
        this.attachEvent("onmousedown",down);
    }
});

//开始拖动

</script>
</body>
</html> 



--------------------编程问答-------------------- mark. --------------------编程问答-------------------- to:走猪观花
代码一点反映都没有 --------------------编程问答-------------------- 如何向数据库保存期拖放后的位置呢?
--------------------编程问答-------------------- 比较直观和简单点的,建议看下ext js --------------------编程问答-------------------- webPart就可以实现你要的功能啊 --------------------编程问答-------------------- 我也想要这种功能,还没找到
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,