日期:2014-05-16  浏览次数:20362 次

求解下面代码的return和其中的一个()
<div class="draggable" style="position:absolute; width:100px; height:100px; background-color:#FF0000"></div>


<script type="text/javascript">
 var eventUtil={
  addHandler: function(element,type,handler){
     if(element.addEventListener){
        element.addEventListener(type,handler,false);
        }else if(element.attachEvent){
              element.attachEvent("on" + type, handler);
        }else{
              element["on" + type] = handler;
       }
 },
 
 getEvent:function(event){
          return event ? event : window.event;
 },
 
 getTarget:function(event){
           return event.target || event.srcElement;
 },

 removeHandler: function(element,type,handler){
                if(element.removeEventListener){
                   element.removeEventListener(type,handler,false);
            }else if(element.detachEvent){
                  element.detachEvent("on" + type,handler);
            }else{
                element["on" + type] = null;
           }
     }
};

//
var DragDorp = function(){
    
    var dragging = null;
    var diffX = 0;
    var diffY = 0;
    function handleEvent(event){
      
       //获取事件和目标
       event = eventUtil.getEvent(event);
       var target = eventUtil.getTarget(event);