欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ExtJS的拖拽效果示例

程序员文章站 2022-03-20 23:07:39
复制代码 代码如下: hello
复制代码 代码如下:

<html>
<head>
<title>hello</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="http:10.19.1.55/lib/extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="http:10.19.1.55/lib/extjs/bootstrap.js"></script>
<script type="text/javascript" src="http:10.19.1.55/lib/extjs/locale/ext-lang-zh_cn.js"></script>
<style type="text/css">
</style>
<script type="text/javascript">
ext.onready(function(){
var drags=document.getelementsbytagname('li');
for(var i=0;i<drags.length;i++)
{
ext.dd.registry.register(drags[i]);
}
new ext.dd.dragzone('today');
new ext.dd.dragzone('tmrw');

function drop(dropnodedata,source,event,dragnodedata)
{
var dragged=source.dragdata.ddel;
var sourcecontainer=source.el.dom;
var descontainer=this.getel();
sourcecontainer.removechild(dragged);
descontainer.appendchild(dragged);

return true;
}
var cfg={onnodedrop:drop};
new ext.dd.dropzone('today',cfg);
new ext.dd.dropzone('tmrw',cfg);
})
</script>
</head>
<body>
<h1>today</h1>
<ul id="today">
<li>shopping</li>
<li>haircut</li>
</ul>
<h1>tomorrow</h1>
<ul id="tmrw">
<li>123</li>
<li>456</li>
</ul>
</body>
</html>