在IE下可以显示出 像QQ空间相册那样,带左右箭头,翻页的效果,但在火狐下不显示,效果演示:http://d.lanrentuku.com/down/js/tupian-748/代码如下:<body><script>
function upNext(bigimg){
var lefturl = '01.html';
var righturl = '03.html';
var imgurl = righturl;
var width = bigimg.width;
var height = bigimg.height;
bigimg.onmousemove=function(){
if(event.offsetX<width/2){
bigimg.style.cursor = 'url(images/arr_left.cur),auto';
imgurl = lefturl;
}else{
bigimg.style.cursor = 'url(images/arr_right.cur),auto';
imgurl = righturl;
}
}
bigimg.onmouseup=function(){
top.location=imgurl;
}
}
</script><img onmouseover="upNext(this)" src="images/02.jpg" />
</body>

解决方案 »

  1.   

    百度了一下,比较常见的解决方法是
    event = (event)?event:window.event;
      

  2.   

    可以尝试在
    if(event.offsetX<width/2){
    上面加这一行
    event = (event)?event:window.event;
      

  3.   

    我按你的方法,加上了,可是现在IE和火狐都一样不好用了,请问还有别的办法吗
    <script>
    function upNext(bigimg){
    var lefturl = '01.html';
    var righturl = '03.html';
    var imgurl = righturl;
    var width = bigimg.width;
    var height = bigimg.height;
    bigimg.onmousemove=function(){
    event = (event)?event:window.event;   //新加代码
    if(event.offsetX<width/2){
    bigimg.style.cursor = 'url(images/arr_left.cur),auto';
    imgurl = lefturl;
    }else{
    bigimg.style.cursor = 'url(images/arr_right.cur),auto';
    imgurl = righturl;
    }
    }
    bigimg.onmouseup=function(){
    top.location=imgurl;
    }
    }
    </script>
      

  4.   

    我也遇到了这样的问题(用了event),在FireFox中不能使用,在IE中可以,原因是FireFox中没有获得event。后来在网上找了一个在FireFox中获得event的方法,加上后,就可以用了,你这个我不太清楚,因为不知道FireFox中event.offsetX是不是这样获得。
    在FireFox中获得event的方法代码如下:/**
     * 在Firefox中获event
     */
    function FixPrototypeForGecko() {
    window.constructor.prototype.__defineGetter__("event", window_prototype_get_event);
    }function window_prototype_get_event() {
    return SearchEvent();
    }
    function SearchEvent() {
    if (document.all)
    return window.event; func = SearchEvent.caller; while (func != null) {
    var arg0 = func.arguments[0]; if (arg0 instanceof Event) {
    return arg0;
    }
    func = func.caller;
    }
    return null;
    }
      

  5.   

    找个flash去吧   好用多了
      

  6.   

    关键在与event, 在Firefox和IE下去event是不一样的,所以你需要判断来得到正确的event.
    event = (event)?event:window.event; 楼上已经给出了,是最简单的方法。
      

  7.   

    好像火狐里不支持 event.offsetX   这样该怎么替换呢