dropzonebehavior.js

来自「《ajax编程技术与实例》的所有的案例」· JavaScript 代码 · 共 46 行

JS
46
字号
Type.registerNamespace('Custom.UI');

Custom.UI.DropZoneBehavior = function() {
    Custom.UI.DropZoneBehavior.initializeBase(this);
    
    this.initialize = function() {
        Custom.UI.DropZoneBehavior.callBaseMethod(this, 'initialize');
        // Register ourselves as a drop target.
        Sys.UI.DragDropManager.registerDropTarget(this);        
    }
    this.dispose = function() {
        Custom.UI.DropZoneBehavior.callBaseMethod(this, 'dispose');
    }
    this.getDescriptor = function() {
        var td = Custom.UI.DropZoneBehavior.callBaseMethod(this, 'getDescriptor');
        return td;
    }    
    
    // IDropTarget members.
    this.get_dropTargetElement = function() {
        return this.control.element;
    }
    this.drop = function(dragMode, type, data) { 
        alert('dropped');
    }
    this.canDrop = function(dragMode, dataType) {
        return true;
    }
    this.onDragEnterTarget = function(dragMode, type, data) {
    }
    this.onDragLeaveTarget = function(dragMode, type, data) {
    }
    this.onDragInTarget = function(dragMode, type, data) {
    }
}
Custom.UI.DropZoneBehavior.registerClass('Custom.UI.DropZoneBehavior', Sys.UI.Behavior, Sys.UI.IDragSource, Sys.UI.IDropTarget, Sys.IDisposable);
Sys.TypeDescriptor.addType('script', 'DropZoneBehavior', Custom.UI.DropZoneBehavior);








⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?