2010-08-03 17 views
-3

e.preventDefault()在我的IE6中不起作用。你能否提供一些代碼讓它在IE中也能工作?e.preventDefault()在IE6中不起作用

我使用這個功能不是錨標記,但在圖像標籤,所以每當有人點擊的圖像上,他應該在年底到位的e.preventDefault()你也可以return false;是ABLTØ拖過圖像

+4

IE6中的e.preventDefault()沒有任何問題。我知道這一點,因爲我在整個已經在所有瀏覽器中測試過的應用程序中廣泛使用它。你能詳細說明'不在IE6中工作嗎?'嗎? – karim79 2010-08-03 03:03:34

+1

您是否將它作爲正式參數傳遞給您的匿名函數?例如函數(e < - this here){e.preventDefault()}'? – karim79 2010-08-03 03:13:36

+0

http://stackoverflow.com/questions/3393399/jquery-i-have-an-issue-when-drag-a-part-of-an-image-to-select-its-parts是我的實際問題 – john 2010-08-03 03:28:49

回答

2

這樣的代碼,

$('a').click(function(){ 
    // other codes 
    return false; 
}); 
+0

http:// stackoverflow .com/questions/3393399/jquery-i-have-an-issue-when-drag-a-part-of-an-image-to-select-its-parts是我的實際問題 – john 2010-08-03 03:33:23

0

嘗試添加e.stop()或返回false在您的函數結束。

+0

http://stackoverflow.com/questions/3393399/jquery-i-have-an-issue-when-drag-a-part-of-a-image-to-select-its-parts是我的實際問題 – john 2010-08-03 03:33:55

1

使用此:

return false; 

代替e.prevendefault();

+0

http://stackoverflow.com/questions/3393399/jquery-i-have-an-issue-when-drag-a-part-of-a-image-to-select-its-parts是我的實際問題 – john 2010-08-03 03:27:07

相關問題