现在的位置: 首页 > 综合 > 正文

js 获取ocx数据

2013年05月31日 ⁄ 综合 ⁄ 共 2293字 ⁄ 字号 评论关闭

Js还真是强大,看看它是如何获得ocx中的数据的

 

  <form name="form1" action="">
   <input type="hidden" value="<ww:property value='stencilUrl'/>" name="JpgUrl" />
   <input type="hidden" value="<ww:property value='stencil.id'/>" name="StencilId" />

   <input type="hidden" value="0" name="Tag" id="Tag" />
   <input type="hidden" value="http://10.10.10.240:8080/box/stencilArea/stencilAreaAdd.action" name="UrlStencil" id="UrlStencil" />
   <input type="hidden" value="<%=request.getContextPath()%>/createImageByOcx.action" name="UrlImage" id="UrlImage" />

  </form>

  <p>
   <OBJECT id="DOcxtest1" width="1035" height="768" class="ocxPosEdt.ocx" classid="clsid:5E365B7D-962F-421A-B4B2-332AB23AF60D" CODEBASE="http://10.10.10.240:8080/box/ocx/ocxPosEdt.cab#Version=1,0,0,000">
    <PARAM NAME="_Version" VALUE="65536" name="" />
    <PARAM NAME="_ExtentX" VALUE="2646" name="" />
    <PARAM NAME="_ExtentY" VALUE="1323" name="" />
    <PARAM NAME="_StockProps" VALUE="0" name="" />
   </OBJECT>
  </p>

<script language="javascript" for=DOcxtest1 event=PostData>
 var strPostData = DOcxtest1.PostData;

 if (document.getElementById("Tag").value=="0"){
  _sd_Post(document.getElementById("UrlStencil").value,strPostData);
 }else{
  _sd_Post(document.getElementById("UrlImage").value,strPostData);
 }
</script>

<script language="javaScript">
 var xmlhttp;
 function _sd_Post(Url, Args)
 {

  var error;
  eval('try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {xmlhttp = null;error=e;}');
  if(null != xmlhttp)
  {
   xmlhttp.onreadystatechange = processRequest;
   xmlhttp.Open("POST", Url, false);
   xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   xmlhttp.Send(Args);
  }
  else
  {
   location.href = "<%=request.getContextPath()%>/error.jsp";
  }
 }
 function processRequest(){
      if (xmlhttp.readyState == 4) {
          if (xmlhttp.status == 200) {    
   
     var strText = xmlhttp.responseText;
     alert(strText);
     // if our response starts with http than redirect there
     if ( strText != null && strText.toLowerCase().indexOf("ok") == 0 )
     {
      location.href = "<%=request.getContextPath()%>/ok.jsp";
     }                   
          } else {
             alert ( "Not able to retrieve description" + req.statusText);
             
    }
      } 
}
 
</script>

  <script language="vbscript" type="">
  <!--
   DOcxtest1.Tag = "0"
   DOcxtest1.StencilId = form1.StencilId.value
   DOcxtest1.JpgUrl = form1.JpgUrl.value
   
  -->
  </script>

 

抱歉!评论已关闭.