下面是用javascript写的函数。在IE下能够实现,但在火狐和其他非IE内核的不能兼容。
听说jquery能兼容各个浏览器版本。所以想叫大家帮我改写,用jquery写。谢谢了。 
function show() {
            document.getElementById("Imgdetail").style.display = "block";
            document.getElementById("Imgdetail").style.left = event.clientX + document.body.scrollLeft;
            document.getElementById("Imgdetail").style.top = event.clientY + document.body.scrollTop;
        }
        function hid() {
            document.getElementById("Imgdetail").style.display = "none";
        }
    </script>

解决方案 »

  1.   


    function getEvent(){
    return window.event||arguments.callee.caller.arguments[0];
    }将你的event换成getEvent()即可
      

  2.   

    $("#Imgdetail").css('display','block');
    $("#Imgdetail").css('left','');
    $("#Imgdetail").css('top','');
      

  3.   

    这样写 function show(e) {
    var left = e.pageX;
    var top = e.pageY;
    $("#Imgdetail").css({display: 'block', left: left, top: top});
    }
    function hid() {
    $("#Imgdetail").css("display", "none");
    }
            
            //事件监听这样加
            $(document.body).click = show;
      

  4.   

    不行啊,我是在
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                LinkButton linkdetials = e.Row.FindControl("LBDetials") as LinkButton;
                if (linkdetials != null)
                {
                    linkdetials.CommandArgument = e.Row.RowIndex.ToString();                linkdetials.Attributes.Add("onmouseover", "show()");
                    linkdetials.Attributes.Add("onmouseout", "hid()");
                }
               
            }
        }定义监听的,怎么改 在。
      

  5.   


    jquery
    function show(event) {
         event = event || window.event;
         $("#Imgdetail").css({"display": "block", left: Number(event.clientX) + Number($("body").scrollLeft()), top: Number(event.clientY) + Number($("body").scrollTop())});
    }function hide() {
         $("#Imgdetail").css("display", "none");
    }
      

  6.   


      linkdetials.Attributes.Add("onmouseover", "show()");
      linkdetials.Attributes.Add("onmouseout", "hid()");改成  
      linkdetials.Attributes.Add("onmouseover", "show(e)");
      linkdetials.Attributes.Add("onmouseout", "hid(e)");
      

  7.   

    改成   
      linkdetials.Attributes.Add("onmouseover", "show("+e+")");
      linkdetials.Attributes.Add("onmouseout", "hid("+e+")");