function handler(e){
  e = e || window.event;
//...
}ff的事件对象是在调用是传进去的,不是放在window的event对象(只有ie是这样)

解决方案 »

  1.   

    然后ie和ff返回的button值是不一样的
      

  2.   

    鼠标坐标
    ie                              ff
    offsetX                       pageX          鼠标方面的好象就这一个写法不同
    一个简单的例子
    <body><div id="ss" style=" height:300px; width:400px; border:1px solid #000000">
    <div id="sss" style=" height:150px; width:200px; border:1px solid #000000; margin-left:50px;"></div>
    </body></div>
    <script>
    alert("宽  "+document.getElementById("ss").offsetLeft+"高   "+document.getElementById("ss").offsetTop)
    alert("宽  "+document.getElementById("sss").offsetLeft+"高   "+document.getElementById("sss").offsetTop)
    </script>document.body.scrollLeft; //滚动条的坐标 
    document.body.scrollTop; 
    这个ie   ff下都是通用的   不知道你说的不好用是什么意思event.button==1 || event.button==0;
    一般写成
    <div onclick="xx(event)"></div>
    <script>
    function xx(e){
    e = e || event   //这个地方要兼容
    e.button==1 || e.button==0;
    }
    </script>event.srcElement.id;function xx(e){
    e = e || event
    var obj = e.srcElemebt.id || e.target.id
    }
    document.onmousemove=move; //调函数move 
    document.onmousedown=down; 
    这个不好用????    实在没搞明白  能给个例子吗???   想学习下
      

  3.   

    先说一下document.body.scrollLeft和document.body.scrollTop的问题<script>
    document.body.scrollTop=document.body.scrollHeight - document.body.clientHeight
    </script>上面的脚本在IE下没问题,在FF下是有问题的,原因不是FF没有这个属性,而是渲染的问题 就是ie和火狐处理是不一样的 也就直接可以说FF这个时候还没有加载完毕 我们就改属性了所以,如果代码改成:
    <script>
    window.onload = function(){
    document.body.scrollTop=document.body.scrollHeight - document.body.clientHeight
    }
    </script>这回就会正常运行了
      

  4.   

    对于e = e || event  //这个地方要兼容 我以前一直用的是var e=e||window.event;你换换试试看至于document.onmousemove
    <script>
    document.onmousemove=move;
    function move(e){
    }
    </script>我觉得这样写没什么问题。
      

  5.   

    event.srcElement.id; //鼠标点击元素的id 
    /*firefox  event*/ 
    function __firefox(){ 
    HTMLElement.prototype.__defineGetter__("runtimeStyle", __element_style); 
    window.constructor.prototype.__defineGetter__("event", __window_event); 
    Event.prototype.__defineGetter__("srcElement", __event_srcElement); 

    function __element_style(){ 
    return this.style; 

    function __window_event(){ 
    return __window_event_constructor(); 

    function __event_srcElement(){ 
    return this.target; 

    function __window_event_constructor(){ 
    if(document.all){ 
    return window.event; 

    var _caller = __window_event_constructor.caller; 
    while(_caller!=null){ 
    var _argument = _caller.arguments[0]; 
    if(_argument){ 
    var _temp = _argument.constructor; 
    if(_temp.toString().indexOf("Event")!=-1){ 
    return _argument; 


    _caller = _caller.caller; 

    return null; 

    if(window.addEventListener){ 
    __firefox(); 

    /*end firefox*/ 
      

  6.   

    上面代码重新event,使在IE和FF中都可以使用:
    实际应用:
    $(_div+id).style.left=__window_event().clientX+getScrollLeft()+10;
    $(_div+id).style.top=__window_event().clientY+getScrollTop()+10;
      

  7.   

    document.body.scrollLeft; //滚动条的坐标 
    document.body.scrollTop; 
    虽然通用,但不同浏览器有其区别,建议多看一些相关的帖子:
    /*ScrollTop*/
    function getScrollTop() {    
        var scrollPos = 0;     
        if (typeof window.pageYOffset != 'undefined') {     
           scrollPos = window.pageYOffset;     
        }     
        else if (typeof window.document.compatMode != 'undefined' &&     
           window.document.compatMode != 'BackCompat') {     
           scrollPos = window.document.documentElement.scrollTop;     
        }     
        else if (typeof window.document.body != 'undefined') {     
           scrollPos = window.document.body.scrollTop;     
        }     
        return scrollPos;    
    }
    /*end ScrollTop*//*ScrollLeft*/
    function getScrollLeft(){
        var scrollPos =0;
        if (typeof window.pageXOffset != 'undefined') {     
           scrollPos = window.pageXOffset;     
        }     
        else if (typeof window.document.compatMode != 'undefined' &&     
           window.document.compatMode != 'BackCompat') {     
           scrollPos = window.document.documentElement.scrollLeft;     
        }     
        else if (typeof window.document.body != 'undefined') {     
           scrollPos = window.document.body.scrollLeft;     
        }     
        return scrollPos;    
    }
    /*end ScrollLeft*/如上是我写的两个关于scrollLeft,scrollTop的,如有错误,请指出,大家一起学习
      

  8.   

    这些都是常用的,你到 www.7uu.cn 查看源码下载那个publicjs吧。里面都有。好像也有注释,地址是 http://images3.7uu.cn/js/public.js拿下来取出你想要的吧
      

  9.   

    event.x; //鼠标坐标 
    event.y; 
    这个是不行的event.x 与 event.y 问题
    (1)现有问题
    在IE 中,event 对象有 x, y 属性,MF中没有。
    (2)解决方法
    在MF中,与event.x 等效的是 event.pageX。但event.pageX IE中没有。
    故采用 event.clientX 代替 event.x。在IE 中也有这个变量。
    event.clientX 与 event.pageX 有微妙的差别(当整个页面有滚动条的时候),不过大多数时候是等效的。