firefox的鍵盤事件
[code]function fun_enter(){if(event.keyCode==13)
fun_go();
}[/code]我在文字方塊寫「onkeydown="fun_enter()"」
但只有IE能執行? 在firefox的錯誤主控台裡可以看到event is not defined
把碼改成這樣就可以了[code]<script>
function fun_enter(e){
if(e.keyCode==13)
fun_go();
}
</script>
<input type="text" onkeydown="fun_enter(event)">[/code]咕狗到的
[url]http://www.webmaster-talk.com/javascript-forum/40661-javascript-works-ie-but-not-firefox.html[/url] 謝謝,可以用了
但這兩種寫法看起來一樣啊? 差異在於 Firefox 必須把 event 給傳到 function 內
頁:
[1]