2014-04-24 143 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