[操作疑難] 支援其他瀏覽器

想問下以下code 應該係一段好耐只支援舊ie ,有方法改成支援新? 謝謝
  1. <SCRIPT language=JavaScript>
  2. <!--

  3. if (navigator.appName.indexOf("Internet Explorer") != -1)
  4. document.onmousedown = noSourceExplorer;

  5. function noSourceExplorer()
  6. {
  7. if (event.button == 2 | event.button == 3 | event.button == 4)
  8. {
  9. alert("dda");
  10. location.replace("#");
  11. }
  12. }
  13. //-->
  14. </SCRIPT>
複製代碼

想問下以下code 應該係一段好耐只支援舊ie ,有方法改成支援新? 謝謝
mytempo 發表於 2016-1-2 00:40




  del   if (navigator.appName.indexOf("Internet Explorer") != -1)  

TOP

del   if (navigator.appName.indexOf("Internet Explorer") != -1)
student_abc 發表於 2016-1-2 10:47


即係要支援firefox chrome 等,刪除  if (navigator.appName.indexOf("Internet Explorer") != -1)  就可以嗎?

如下
  1. <SCRIPT language=JavaScript>
  2. <!--

  3. document.onmousedown = noSourceExplorer;

  4. function noSourceExplorer()
  5. {
  6. if (event.button == 2 | event.button == 3 | event.button == 4)
  7. {
  8. alert("dda");
  9. location.replace("#");
  10. }
  11. }
  12. //-->
  13. </SCRIPT>
複製代碼

TOP

即係要支援firefox chrome 等,刪除  if (navigator.appName.indexOf("Internet Explorer") != -1)  就可 ...
mytempo 發表於 2016-1-2 11:41



    if you del it, your program can run in all broswer.  But i suggest you try to test. it is not all correct

TOP

I can't get the purpose of the code.
You can simply use jQuery.on(); for cross browser

TOP