1. official website to download js, js and put into the elements of the page to be displayed inside
2. Add method on body onload
Write code inside 3.js
code show as below:
function WebOpen(){
obj = document.getElementById('WebOffice');//获得控件对象
if (obj)setTimeout('openfile()',1000);//等待控件初始化完毕,时间可以根据网络速度设定。
}
function openfile()
{
//获取文件名
var pfile="hi.docx";
var strOpenUrl="";
$.ajax({
type : "post",
url : "../../br/detial/problem/getTomcatPath",
data :"",
dateType : "json",
success : function(result) {
strOpenUrl= result+"detialProblemImg/"+ pfile ; //取得打开路径和文件名
document.getElementById('WebOffice').Open(strOpenUrl,false,"Word.Document");
/* document.getElementById('WebOffice').LoadOriginalFile("http://localhost:8080/MTJC/detialProblemImg/hi.doc","doc"); */
}
});
}
Special note: run plugins need to install plug-in environment, the official website has downloads