在网页中使用ActiveX时如果,ocx控件的方法中的参数是BSTR* 的类型,使用脚本怎么调用 <SCRIPT language=VBscript>dim resultdim Retresult = SendCmdToServer ( 1 ,"","",0, ByRef Ret )</SCRIPT> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //convert numeric into string likes fmtfunction format(val,fmt){ val=parseFloat(""+val); if (val>=0) return _format(val,fmt); else return "-"+_format(-val,fmt);}function _format(val,fmt){ //val=parseFloat(""+val); if(isEmptyString(fmt)) fmt="#,##0.00"; var pat,reg,i,hp,bp,tp,bLen; var vhp,vtp; //fmt="#,##0";///////分解格式化字符串 reg=/^([#0]+)(,[#0]+)?(\x2e[0]*)?$/; pat=fmt.match(reg); hp=bp=tp=""; for(i=pat.length-1 ;i>0;i--) switch(pat[i].substring(0,1)) { case ",": bp=pat[i].substr(1); break; case ".": tp=pat[i].substr(1); break; default: hp=pat[i]; break; } if (bp=="") { bLen=0;//不分段 } else { hp=bp; bLen=bp.length;///分段长度 } //求整数部分最小长度 var zeroLen=hp.match(/^#*(0*)$/)[1].length; //////////////分解数据字符串 val=""+val; reg=/^(\d*)(\x2e\d*)?$/; pat=val.match(reg); vhp=vtp=""; for(i=pat.length-1 ;i>0;i--) switch(pat[i].substring(0,1)) { case ".": vtp=pat[i].substr(1); break; default: vhp=pat[i]; break; } //////////小数部分 if(vtp.length>tp.length && vtp.substr(tp.length,1)>"4") //进行进位计算 { var inc="1"; for(i=1;i<tp.length;i++) inc="0"+inc;inc="0."+inc; vtp=vtp.substr(0,tp.length); val=parseFloat(vhp+"."+vtp)+parseFloat(inc); val=""+val; pat=val.match(reg); vhp=vtp=""; for(i=pat.length-1 ;i>0;i--) switch(pat[i].substring(0,1)) { case ".": vtp=pat[i].substr(1); break; default: vhp=pat[i]; break; } } else vtp=vtp.substr(0,tp.length); while(vtp.length<tp.length) vtp+="0"; //////////整数部分 while(vhp.length<zeroLen) vhp="0"+vhp; //补足足够的长度 //alert(bLen); if(bLen>0) //加逗号分割 { var cnt=0; cnt= bLen-(vhp.length - Math.floor(vhp.length/bLen)*bLen); if(cnt==bLen) cnt=0; for(i=0;i<cnt;i++) vhp="0"+vhp; reg=new RegExp("(\\d{"+bLen+"})","gi"); //reg=/(\d{3})/g; vhp=vhp.replace(reg,",$1"); vhp=vhp.substr(cnt+1); } return vhp+"."+vtp;} 在弱类型语言中调用的Active X 不能使用除variant类型外的其余类型. 具体的使用如下:<HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <script language="javascript"> function testpdm() { var result=""; PdmAgent.SendCmdToServer(1, "ID_APP_PDM_SEARCH", "", 0,result); } </script> </HEAD> <body MS_POSITIONING="GridLayout"> <OBJECT id="PdmAgent" classid="clsid:AD180329-2C39-4109-89AA-2354D28ED6C2" VIEWASTEXT> <PARAM NAME="_Version" VALUE="65536"> <PARAM NAME="_ExtentX" VALUE="2646"> <PARAM NAME="_ExtentY" VALUE="1323"> <PARAM NAME="_StockProps" VALUE="0"> </OBJECT> <form id="Form1" method="post" runat="server"> <INPUT style="Z-INDEX: 102; LEFT: 92px; POSITION: absolute; TOP: 23px" type="button" onclick="testpdm()" value="pdm"> </FONT> </form> </body></HTML>使用<script language="vbscript"> Function testpdm() Dim result dim Ret result = PdmAgent.SendCmdToServer(1, "ID_APP_PDM_SEARCH", "", 0, ByRef Ret) End Function </script>还是有问题 yonghengdizhen(傅立叶变换)如不可使用,那不是要改写ocx? 在IE 6 IE7 IE8显示flash 在平板电脑显示 请教下kindeditor的问题 求解这个JS 在jsp界面如何能用鼠标拖出一个圆形区域 .sql文件下下来为0kb 怎么回事 javascript 类的问题 高手请看,如何用javascript编历一个form中所有的select控件!! 请wsj(骆驼)进来 如何让浏览器中显示的word文档不能修改和拷贝 绝对兑现!!! 这种写法<input type=image src='image/login.jpg'>的含义? 为何在同一页面只能接受一次从location.href中传来的参数。。。
function format(val,fmt)
{
val=parseFloat(""+val);
if (val>=0)
return _format(val,fmt);
else
return "-"+_format(-val,fmt);
}
function _format(val,fmt)
{
//val=parseFloat(""+val);
if(isEmptyString(fmt)) fmt="#,##0.00";
var pat,reg,i,hp,bp,tp,bLen;
var vhp,vtp;
//fmt="#,##0";
///////分解格式化字符串
reg=/^([#0]+)(,[#0]+)?(\x2e[0]*)?$/;
pat=fmt.match(reg);
hp=bp=tp="";
for(i=pat.length-1 ;i>0;i--)
switch(pat[i].substring(0,1))
{
case ",":
bp=pat[i].substr(1);
break;
case ".":
tp=pat[i].substr(1);
break;
default:
hp=pat[i];
break;
}
if (bp=="")
{
bLen=0;//不分段
}
else
{
hp=bp;
bLen=bp.length;///分段长度
}
//求整数部分最小长度
var zeroLen=hp.match(/^#*(0*)$/)[1].length;
//////////////分解数据字符串
val=""+val;
reg=/^(\d*)(\x2e\d*)?$/;
pat=val.match(reg);
vhp=vtp="";
for(i=pat.length-1 ;i>0;i--)
switch(pat[i].substring(0,1))
{
case ".":
vtp=pat[i].substr(1);
break;
default:
vhp=pat[i];
break;
}
//////////小数部分
if(vtp.length>tp.length && vtp.substr(tp.length,1)>"4") //进行进位计算
{
var inc="1";
for(i=1;i<tp.length;i++) inc="0"+inc;inc="0."+inc;
vtp=vtp.substr(0,tp.length);
val=parseFloat(vhp+"."+vtp)+parseFloat(inc);
val=""+val;
pat=val.match(reg);
vhp=vtp="";
for(i=pat.length-1 ;i>0;i--)
switch(pat[i].substring(0,1))
{
case ".":
vtp=pat[i].substr(1);
break;
default:
vhp=pat[i];
break;
}
}
else
vtp=vtp.substr(0,tp.length);
while(vtp.length<tp.length) vtp+="0";
//////////整数部分
while(vhp.length<zeroLen) vhp="0"+vhp; //补足足够的长度
//alert(bLen);
if(bLen>0) //加逗号分割
{
var cnt=0;
cnt= bLen-(vhp.length - Math.floor(vhp.length/bLen)*bLen);
if(cnt==bLen) cnt=0;
for(i=0;i<cnt;i++) vhp="0"+vhp;
reg=new RegExp("(\\d{"+bLen+"})","gi");
//reg=/(\d{3})/g;
vhp=vhp.replace(reg,",$1");
vhp=vhp.substr(cnt+1);
}
return vhp+"."+vtp;
}
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function testpdm()
{
var result="";
PdmAgent.SendCmdToServer(1, "ID_APP_PDM_SEARCH", "", 0,result);
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<OBJECT id="PdmAgent" classid="clsid:AD180329-2C39-4109-89AA-2354D28ED6C2" VIEWASTEXT>
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_ExtentX" VALUE="2646">
<PARAM NAME="_ExtentY" VALUE="1323">
<PARAM NAME="_StockProps" VALUE="0">
</OBJECT>
<form id="Form1" method="post" runat="server">
<INPUT style="Z-INDEX: 102; LEFT: 92px; POSITION: absolute; TOP: 23px" type="button" onclick="testpdm()" value="pdm">
</FONT>
</form>
</body>
</HTML>使用
<script language="vbscript">
Function testpdm()
Dim result
dim Ret
result = PdmAgent.SendCmdToServer(1, "ID_APP_PDM_SEARCH", "", 0, ByRef Ret)
End Function
</script>
还是有问题