中国开发网: 论坛: 程序员情感CBD: 贴子 105278
ahfei
谢谢各位朋友,我已经解决了问题。方法如下:
原来在treeview的UltraWebTree1_NodeDropped事件中,event.sourcedata取不到,为null
后查文档,为3个image都加上ondragstart="startDrag()" ondragend="endDrag()"
这样,event就可以拿到sourcedata为被拖拽image的URL

function startDrag(){
// get what is being dragged:
srcObj = window.event.srcElement;

// store the source of the object into a string acting as a dummy object so we don't ruin the original object:
dummyObj = srcObj.outerHTML;

// post the data for Windows:
var dragData = window.event.dataTransfer;

// set the type of data for the clipboard:
dragData.setData('Text', window.event.srcElement.src);

// allow only dragging that involves moving the object:
dragData.effectAllowed = 'linkMove';

// use the special 'move' cursor when dragging:
dragData.dropEffect = 'move';
}

function enterDrag() {
// allow target object to read clipboard:
window.event.dataTransfer.getData('Text');
}

function endDrag() {
// when done remove clipboard data
window.event.dataTransfer.clearData();
}

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录