爱
爱上寂寞
Unregistered / Unconfirmed
GUEST, unregistred user!
我在网页里用javascript调用MSComm
怎么才能取到缓冲区里的数据???
代码如下:
<object id="PrintOCX"
classid="clsid:648A5600-2C6E-101B-82B6-000000000014"
width="0"
height="0"
codebase="service.ecity.com/ocx/MSCOMM32.OCX">
</object>
<script language="javascript">
function PrintVoucher()
{
var Buffer;
PrintOCX.CommPort="1";
if(PrintOCX.PortOpen!="TRUE"
{
PrintOCX.Settings="9600,n,8,1";
//PrintOCX.InputLen="0";
PrintOCX.PortOpen="TRUE";
}
// PrintOCX.Output=String.fromCharCode(27,64);
PrintOCX.Output=String.fromCharCode(16,4,1);
Buffer=PrintOCX.Input;
//这里取返回数据,怎么取不到??
alert(Buffer);
//------------------------------------------------
PrintOCX.Output=String.fromCharCode(29,40,70,4,0,1,0,1,1);
PrintOCX.Output=String.fromCharCode(29,12);
// 送黑标纸至打印起始位置
PrintOCX.Output=String.fromCharCode(27,100,5);
// 打印并进纸n字符行
PrintOCX.Output="中国人民/n";
PrintOCX.Output=String.fromCharCode(29,86,1);*/
PrintOCX.PortOpen="FALSE";
}
怎么才能取到缓冲区里的数据???
代码如下:
<object id="PrintOCX"
classid="clsid:648A5600-2C6E-101B-82B6-000000000014"
width="0"
height="0"
codebase="service.ecity.com/ocx/MSCOMM32.OCX">
</object>
<script language="javascript">
function PrintVoucher()
{
var Buffer;
PrintOCX.CommPort="1";
if(PrintOCX.PortOpen!="TRUE"
{
PrintOCX.Settings="9600,n,8,1";
//PrintOCX.InputLen="0";
PrintOCX.PortOpen="TRUE";
}
// PrintOCX.Output=String.fromCharCode(27,64);
PrintOCX.Output=String.fromCharCode(16,4,1);
Buffer=PrintOCX.Input;
//这里取返回数据,怎么取不到??
alert(Buffer);
//------------------------------------------------
PrintOCX.Output=String.fromCharCode(29,40,70,4,0,1,0,1,1);
PrintOCX.Output=String.fromCharCode(29,12);
// 送黑标纸至打印起始位置
PrintOCX.Output=String.fromCharCode(27,100,5);
// 打印并进纸n字符行
PrintOCX.Output="中国人民/n";
PrintOCX.Output=String.fromCharCode(29,86,1);*/
PrintOCX.PortOpen="FALSE";
}