所以我有一個Firefox的問題與onkeydown事件的圖像按鈕。我不想讓按鈕動作觸發,直到他們放開按鈕。所以這對IE和Chrome都很有用。我無法弄清楚爲什麼它在Firefox中不起作用(20.0.1)。以下是圖像按鈕的代碼:ASP.NET - onkeydown事件不工作在Firefox
<asp:ImageButton ID="btnButton1" ImageUrl="/images/target.png" runat="server"
Height="75" Width="75" onkeydown="return false;" onkeyup="ButtonClick()" />
所以看起來的onkeyup在所有瀏覽器的工作完美,但的onkeydown不希望在Firefox的工作,我無法弄清楚。任何幫助將不勝感激。
我不知道它是否會有所幫助,但我會後我的JavaScript函數的onkeyup還有:
function ButtonClick() {
document.getElementById('<%=btnButton1.ClientID %>').click();
return true;
}
Theres另一個話題涉及到Firefox的這個問題!看看這裏:http://stackoverflow.com/questions/642040/firefox-onkeydown-detect-pressed-key!希望它幫助你 – Fals 2013-05-14 18:16:30