js 获取ocx数据

这篇博客展示了如何利用JavaScript与OCX控件进行交互,获取OCX中的数据,并通过POST请求发送到指定URL。文章中包含HTML表单、JavaScript函数以及VBScript代码示例,详细解释了数据传递和页面重定向的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值