类似MSN space 的那种我写过,不过可定制性太差,代码也很乱
有时间再整理整理,先顶一下
有时间再整理整理,先顶一下
解决方案 »
- 关于图片的延迟加载
- 【如何获取注册页面表单中元素的内容?】
- js模态窗口 刷新父页面(求救大侠)
- google map api 标记如何显示文字?
- 油个问题噢!
- 求解决方法,关于用js获取当前网页html代码,并且要求是 xhtml 格式的。
- 我有别人的视频控件.ocx文件和方法说明:大伙儿教我如何使用,试成功了可以给你一份源码。
- 两个页面,如何在不刷新页面的情况下把第二个页面上的text的值传到第一个页面上?
- 火狐浏览器如何禁用地址栏跳转(包括刷新)
- 在js实现一移到超链接上就显示一个框
- onclick问题 急 在线等,谢谢!
- 50求js源码:像window的文件列表,通过拖动鼠标该表table的列宽,双击分隔线自动调整为内容的宽度,还可以点击排序?
<head>
<title> Drag Demo 2 </title>
<style type="text/css">
<!--
#drag{
width:100px;
height:20px;
background-color:#eee;
border:1px solid #333;
position:absolute;
top:30px;
left:200px;
text-align:center;
cursor:default;
}
//-->
</style>
<script type="text/javascript">
<!--
window.onload=function(){
drag(document.getElementById('drag'),[200,400,30,30]);
};function drag(o,r){
o.onmousedown=function(a){
var d=document;if(!a)a=window.event;
var x=a.layerX?a.layerX:a.offsetX,y=a.layerY?a.layerY:a.offsetY;
if(o.setCapture)
o.setCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); d.onmousemove=function(a){
if(!a)a=window.event;
if(!a.pageX)a.pageX=a.clientX;
if(!a.pageY)a.pageY=a.clientY;
var tx=a.pageX-x,
ty=a.pageY-y;
o.style.left=tx<r[0]?r[0]:tx>r[1]?r[1]:tx;
o.style.top=ty<r[2]?r[2]:ty>r[3]?r[3]:ty;
}; d.onmouseup=function(){
if(o.releaseCapture)
o.releaseCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove=null;
d.onmouseup=null;
};
};
}
//-->
</script>
</head><body>
<div id="drag">drag me</div>
</body>
</html>
这个是托拽的核心代码,楼主可以研究一下。跨浏览器的。
至于第二个问题,可以给每个div设置一个id值,提交的时候遍历id,再把id提交到后台就ok!