ahfei:
谢谢各位朋友,我已经解决了问题。方法如下:
[阅读: 633] 2005-03-01 08:54:42
原来在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();
}