ff下addeventlistener的疑问
代码如下:
<html>
<head>
<title> 鼠标拖曳 </title>
</head>
<body>
<div id= "div1 " style= "position:absolute;width:150px;height:100px;background-color:blue; ">
abcd
</div>
<script language= "javascript ">
var Class = {
create: function () {
return function () {
this.initialize.apply(this, arguments);
};
}
};
var drag = Class.create();
drag.prototype = {
initialize : function() {
var dr = this;
dr.o = null;
},
setObject : function(o) {
var dr = this;
dr.o = o;
dr.bind();
},
bind : function() {
var dr = this;
if (dr.o){
if (dr.o.attachEvent){
dr.o.attachEvent( 'onmousedown ',dr.mousedown);
dr.o.attachEvent( 'onmousemove ',dr.mousemove);
dr.o.attachEvent( 'onmouseout ',dr.mouseout);
dr.o.attachEvent( 'onmouseup ',dr.mouseup);
}
else if (dr.o.addEventListener) {
dr.o.addEventListener( '