officeCheck.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. var s, classid, Sys = {},
  2. ua = navigator.userAgent.toLowerCase();
  3. (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : (s = ua.match(/trident\/([\d.]+)/)) ? Sys.ie9 = s[1] : (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] : (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] : (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] : (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0,
  4. classid = "A39F1330-3322-4a1d-9BF0-0BA2BB90E970",
  5. Sys.ie || Sys.ie9 ? (document.write("<!-- 用来产生编辑状态的ActiveX控件的JS脚本--> "),
  6. document.write("<!-- 因为微软的ActiveX新机制,需要一个外部引入的js--> "),
  7. document.write('<object id="TANGER_OCX" classid="clsid:' + classid + '" '),
  8. document.write('codebase="ntko/OfficeControl.cab#version=5,0,2,5" width="100%" height="115px"> '),
  9. document.write('<param name="IsUseUTF8URL" value="-1"> '),
  10. document.write('<param name="IsUseUTF8Data" value="-1"> '),
  11. document.write('<param name="BorderStyle" value="1"> '),
  12. document.write('<param name="BorderColor" value="14402205"> '),
  13. document.write('<param name="TitlebarColor" value="15658734"> '),
  14. document.write('<param name="TitlebarTextColor" value="0"> '),
  15. document.write('<param name="MenubarColor" value="13158600"> '),
  16. document.write('<param name="MenuButtonColor" VALUE="16180947"> '),
  17. document.write('<param name="MenuBarStyle" value="3"> '),
  18. document.write('<param name="MenuButtonStyle" value="7"> '),
  19. document.write('<param name="WebUserName" value="NTKO"> '),
  20. document.write('<param name="UILangCode" value="AUTO"> '),
  21. document.write('<param name="Serverpage" value="paaa.asp"> '),
  22. document.write('<param name="Caption" value="NTKO OFFICE文档控件示例演示 http://www.ntko.com"> '),
  23. document.write('<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。请点击<a href="media/office/NtkoOfficeControlSetup.msi">安装控件</a></SPAN> '),
  24. document.write("</object>")) : Sys.chrome ? (document.write('<object id="TANGER_OCX" clsid="{' + classid + '}" '),
  25. document.write('type="application/ntko-plug" codebase="ntko/OfficeControl.cab#version=5,0,2,5" width="100%" height="115px"'), document.write('ForOnSaveToURL="OnComplete2" '), document.write('ForOnBeginOpenFromURL="OnComplete" '),
  26. document.write('ForOnDocumentOpened="DocumentOpened" '), document.write('ForOnpublishAshtmltourl="publishashtml" '), document.write('ForOnpublishAspdftourl="publishaspdf" '), document.write('ForOnSaveAsOtherFormatToUrl="saveasotherurl" '),
  27. document.write('ForOnDoWebGet="dowebget" '),
  28. document.write('ForOnDoWebExecute="webExecute" '),
  29. document.write('ForOnDoWebExecute2="WebExecute" '),
  30. document.write('ForOnFileCommand="filecommand" '),
  31. document.write('ForOnCustomMenuCmd2="CustomMenuCmd" '),
  32. document.write('ForOnCustomToolBarCommand="CustomToolBarCom" '),
  33. document.write('ForOnSignSelect="signselect" '),
  34. document.write('_IsUseUTF8URL="-1" '),
  35. document.write('_IsUseUTF8Data="-1" '),
  36. document.write('_BorderStyle="1" '),
  37. document.write('_BorderColor="14402205" '),
  38. document.write('_MenubarColor="14402205" '),
  39. document.write('_MenuButtonColor="16180947" '),
  40. document.write('_MenuBarStyle="3" '),
  41. document.write('_MenuButtonStyle="7" '),
  42. document.write('_WebUserName="NTKO" '),
  43. document.write('_CustomToolBar="-1" '),
  44. document.write('_Caption=" NTKO OFFICE文档控件示例演示" > '),
  45. document.write('<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。请点击<a href="media/office/NtkoOfficeControlSetup.msi">安装控件</a></SPAN> '),
  46. document.write("</object>")) : Sys.firefox ? (document.write('<object id="TANGER_OCX" clsid="{' + classid + '}" '),
  47. document.write('type="application/ntko-plug" codebase="ntko/OfficeControl.cab#version=5,0,2,5" width="100%" height="115px" '),
  48. document.write('ForOnDocumentOpened="DocumentOpened" '),
  49. document.write('ForOnCustomToolBarCommand="CustomToolBarCom" '),
  50. document.write('ForOnFileCommand="filecommand" '),
  51. document.write('ForAfterSaveAsPDFFile="aftersavepdffile" '),
  52. document.write('ForOnpublishAshtmltourl="publishashtml" '),
  53. document.write('ForOnpublishAspdftourl="publishaspdf" '),
  54. document.write('ForOnSaveAsOtherFormatToUrl="saveasotherurl" '),
  55. document.write('ForOnDoWebGet="dowebget" '),
  56. document.write('ForOnDoWebExecute="webExecute" '),
  57. document.write('ForOnDoWebExecute2="webExecute2" '),
  58. document.write('ForOnCustomMenuCmd2="CustomMenuCmd" '),
  59. document.write('ForOnSignSelect="signselect" '),
  60. document.write('_IsUseUTF8URL="-1" '),
  61. document.write('_IsUseUTF8Data="-1" '),
  62. document.write('_BorderStyle="1" '),
  63. document.write('_BorderColor="14402205" '),
  64. document.write('_MenubarColor="14402205" '),
  65. document.write('_MenuButtonColor="16180947" '),
  66. document.write('_MenuBarStyle="3" '),
  67. document.write('_MenuButtonStyle="7" '),
  68. document.write('_WebUserName="NTKO" '),
  69. document.write('_CustomToolBar="-1" '),
  70. document.write('_Caption="NTKO OFFICE文档控件示例演示" >'),
  71. document.write('<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。请点击<a href="media/office/NtkoOfficeControlSetup.msi">安装控件</a></SPAN> '),
  72. document.write("</object> ")) : Sys.opera ? alert("sorry,ntko 暂时不支持opera!") : Sys.safari && alert("sorry,ntko 暂时不支持safari!");