由於某些原因,當通過使用IHTMLElement2.focus()方法調用通過C#代碼觸發時,onfocus事件不會設置window.event(它將變爲null),而不是某個其他對象窗口.Event將設置事件信息。是否有一個原因?我爲InternetExplorer使用ShDocVw界面,這是我第一次看到這個問題。window.Event vs window.event
3
A
回答
1
聽起來像一個典型的微軟錯誤。他們經常遇到區分大小寫的問題,因爲從第一天起,OS就已經被看作是區別。
我建議也許看看這個kb文章http://msdn.microsoft.com/en-us/library/aa703985(v=vs.85).aspx特別是tabindex hooha這聽起來像一個笑話,但你還期望什麼。
然後我會建議嘗試IHTMLElement的第四個變體形式,特別是onfocusin事件作爲onfocus的替代方案。
但最終因爲你通過shdocvw對象控制環境 - 我只是將window.Event對象映射到onfocus處理程序中的window.event對象 - 一行代碼從不傷害任何人 - 除了當一行代碼會傷害堆棧溢出,緩衝區溢出或Out of Memory內存異常:D
相關問題
- 1. javascript window.event未來?
- 2. Javascript,window.event,表單驗證
- 3. 什麼是JavaScript中的window.event?
- 4. 用Javascript window.confirm停止window.event?
- 5. 爲什麼window.event不工作?
- 6. JavaScript事件:window.event VS參數引用(功能)
- 7. 這是什麼意思...「var evt = event || window.event;」
- 8. 瞭解window.event屬性及其用法
- 9. window.event JavaScript代碼無法在Firefox
- 10. window.event不能在firefox上工作
- 11. 「event = event || window.event」找不到成員。 RequiredFieldValidator
- 12. e =事件|| window.event;語句不能在Firefox
- 13. window.event在firefox中不起作用
- 14. 如何以編程方式使用Javascript生成window.event?
- 15. JavaScript代碼說明適用於:(e && e.target)|| (window.event && window.event.srcElement)
- 16. 火狐 - 使用Javascript - window.event無法存活通行證context.apply()
- 17. Internet Explorer 7/8支持正常事件傳遞,不需要window.event?
- 18. 添加window.event處理程序,以打字稿
- 19. window.event NULL錨點標記的點擊處理程序中的NULL
- 20. 無法將屬性分配給Internet Explorer中的window.event(或數據屬性)
- 21. vs vs 2008 vs vs 2010
- 22. Exec的VS ExecWait VS ExecShell VS nsExec :: Exec的VS nsExec :: ExecToLog VS nsExec :: ExecToStack VS ExecDos VS ExeCmd
- 23. FTP vs SFTP vs HDFS vs NTFS vs EXT2,EXT3
- 24. VS VS VS VS 11中的MVC測試
- 25. CGL vs AGL vs OpenGL vs NSOpenGL vs CoreAnimation(CALayer)
- 26. MobileNet VS SqueezeNet VS ResNet50 VS啓V3 VS VGG16
- 27. 應該在e.keyCode之前檢查,反之亦然?
- 28. NTOSKRNL.EXE VS NTKRNLMP.EXE VS NTKRNLPA.EXE VS NTKRPAMP.EXE
- 29. VS 2008 vs VS 2008 Express
- 30. RailwayJS vs Geddy vs Express vs Socket.IO
是的,我們必須更改var evt = e || window.event;到var evt = e || window.event || window.Event;我覺得這很愚蠢,我會嘗試onfocusin。謝謝 – 2011-04-18 02:09:53