日期:2014-05-16 浏览次数:20443 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Dojo DnD test</title> <style type="text/css"> @import "../../resources/dojo.css"; @import "../../resources/dnd.css"; @import "dndDefault.css"; body { padding: 1em; background: #ededed; } .container { BORDER-RIGHT: #669999 2px solid; PADDING-RIGHT: 5px; BORDER-TOP: #669999 2px solid; PADDING-LEFT: 5px; FLOAT: left; PADDING-BOTTOM: 0px; MARGIN: 3px; BORDER-LEFT: #669999 2px solid; WIDTH:150px;HEIGHT:300px;PADDING-TOP: 5px; BORDER-BOTTOM: #669999 2px solid } .containerRight{ BORDER-RIGHT: #669999 2px solid; PADDING-RIGHT: 5px;HEIGHT:400px; BORDER-TOP: #669999 2px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 0px; MARGIN: 3px; BORDER-LEFT: #669999 2px solid; WIDTH:700px;HEIGHT:400px;PADDING-TOP: 5px; BORDER-BOTTOM: #669999 2px solid;height:200px; } .clear { clear: both; } </style> <script type="text/javascript" src="../../dojo.js" djConfig="isDebug: false, parseOnLoad: true"></script> <script type="text/javascript"> dojo.require("dojo.parser"); dojo.require("dojo.dnd.Source"); var total = 0; function ClearMsg() { // dojo.byId("msg").innerHTML = ""; } function init(){ dojo.subscribe("/dnd/start", function(source,nodes,iscopy){ }); dojo.subscribe("/dnd/drop/before", function(source, nodes, copy, target){ if(target == c2){ } }); dojo.subscribe("/dnd/drop", function(source,nodes,iscopy){ var t = dojo.dnd.manager().target; var noid= nodes[0].id; var jsnode = source.getItem(nodes[0].id); var x=c1.getAllNodes(); for(i =0;i<x.length;i++){ //jsNode is javascript object for node //x[i] represents HTML element for the node var jsnode = c2.getItem(x[i].id); } if(nodes){ var node=nodes[0]; if(node.parentNode.id=="left"){ var value=node.innerHTML; node.innerHTML=value.substring(0,value.length-6); var p=document.getElementById(""+noid); p.style.styleFloat = 'none'; }else{ if(node.parentNode.id=="right"){ var value=node.innerHTML; // alert(value.substring(value.length-6,value.length)); if(value.substring(value.length-5,value.length)=="value"){ }e