天天看點

線上編輯office插件(weboffice)使用

論壇:http://forum.dianju.cn/

步驟:(1)在html中引入main.js,loadweboffice.js,style.css即可

       注意:loadweboffice.js或html中節點object的codebase='weboffice/weboffice.ocx' 是必須    的,改成自己weboffice.ocx的路徑

問題:

(1)ie支援所有原生方法,因為它和word是一家的

    要想火狐和谷歌浏覽器也支援,需要安裝 firefox activex plugin。

    并在初始化時寫如下代碼:

var s = "";

if(navigator.useragent.indexof("msie")>0){

s = "<object id='weboffice1' align='middle' style='left: 0px; width: 100%; top: 0px; height:768px'"

+ "classid=clsid:e77e049b-23fc-4db8-b756-60529a35fad5>"

+ "</object>";

}

if(navigator.useragent.indexof("chrome")>0){

s = "<object id='weboffice1' type='application/x-itst-activex' align='baseline' border='0'"

+ "style='left: 0px; width: 100%; top: 0px; height: 768px'"

+ "clsid='{e77e049b-23fc-4db8-b756-60529a35fad5}'"

+ "event_notifyctrlready='weboffice1_notifyctrlready'>"

if(navigator.useragent.indexof("firefox")>0){

+ "style='left: 0px; width: 100%; top: 0px; height: 768px'" 

document.write(s)

(2)火狐谷歌浏覽器無法監聽自定義的工具欄,ie可以監聽。解決辦法,不要用他提供的方法在工具欄上添加按鈕,可自己用div建立按鈕。

繼續閱讀