2014-04-24 121 views
0

我正在使用下面提到的代码按钮mouseover事件。该特定代码修复了mouseover事件的文本位置。它适用于Chrome和IE。但不知何故似乎有一个与Firefox的问题。在Firefox的情况下,位置没有得到修复。风格问题与火狐

有人能指导我什么是错的。

<div id="DownloadHelp" runat="server" style="background-color:white; position:fixed; opacity:0; top:100px; z-index:11; color:blue; font-size:small; background-color:silver; border:thin"> 
    Merge all selected Files 
</div> 

<asp:button onmouseover="display()" onmouseout="fadeHelp()" id="singleFileDownload" Width="140px" Enabled="false" onclick="SingleFileSelections" runat="server" Text="Merge and Download"></asp:button> 

function display() 
{ 
    document.getElementById("DownloadHelp").style.opacity = "1"; 
    var x = event.clientX; 
    var y = event.clientY; 
    document.getElementById("DownloadHelp").style.top = y - 30; 
    document.getElementById("DownloadHelp").style.left = x + 10; 
} 

回答

1

在Firefox中,event对象未公开给全局对象。

这样做:

function display(event) 
{ 
    document.getElementById("DownloadHelp").style.opacity = "1"; 
    var x = event.clientX; 
    var y = event.clientY; 
    document.getElementById("DownloadHelp").style.top = y - 30; 
    document.getElementById("DownloadHelp").style.left = x + 10; 
} 

这:

<asp:button onmouseover="display(event)" onmouseout="fadeHelp()" id="singleFileDownload" Width="140px" Enabled="false" onclick="SingleFileSelections" runat="server" Text="Merge and Download"></asp:button> 
+0

#amit非常感谢。它现在也适用于Firefox。 – PamZy