模板页:
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Insert title here</title> 6 <script type="text/javascript" src="../Public/jquery-1.8.0.min.js"></script> 7 <script type="text/javascript"> 8 $(function() { 9 var OCXobj = document.getElementById("PlayViewOCX");10 OCXobj.SetOcxMode(0);11 $.ajax({12 //要用post方式 13 type : "Post",14 //方法所在页面和方法名 15 url : "../Home/User/GetPreViewXml",16 success : function(data) {17 //返回的数据用data.d获取内容 18 if (data) {19 OCXobj.StartTask_Preview_InWnd(data, 0);20 }21 },22 error : function(err) {23 alert("调用webservice过程中发生了错误!");24 }25 });26 });2738 </script>39 </head>40 <body>41 42 <input id='previewXml' value='{$previewXml}' type='hidden' />43 <div>44 <input type="button" value="开始预览"45 id="StartPlayView" /> <br />46 <div style="width: 750px; float: left; overflow: hidden">47 <br /> 48 <!-- 添加预览控件(需要先在windows下注册) -->49 <object classid="clsid:D5E14042-7BF6-4E24-8B01-2F453E8154D7"50 id="PlayViewOCX" width="750" height="450" name="ocx"> </object>51 </div>52 </div>53 </body>54 </html>