需要加window 網頁右鍵ie不支持event.preventDefault和event.returnValue
【需要加window 網頁右鍵ie不支持event.preventDefault和event.returnValue】event.preventDefault()方法是用于取消事件的默認行為,但此方法并不被ie支持 , 在ie下需要用window.event.returnValue = https://www.questions.com.cn/dnjc/false; 來實現 。
復制代碼 代碼如下:
function stopDefault( e )
{
if ( e
} else { window.event.returnValue = https://www.questions.com.cn/dnjc/false;
} }
您可能感興趣的文章:為密碼文本框要求不可粘帖字符串只可手動輸入(附演示動畫)自定義右鍵屬性覆蓋瀏覽器默認右鍵行為實現代碼js捕獲鼠標右鍵菜單中的粘帖事件實現代碼
