請問 javascript + MSCOMM32.OCX元件問題
想請問一下我想要利用html+javascript 製作一網頁
然後會用到MSCOMM32.OCX這元件
但目前javascript 似乎抓不到MSCOMM32.OCX
CommPort都開不起來 ,狀態都是undefined
請問一下有可能是哪邊出了問題嗎??
謝謝~~~~~~~~~~~~~~~~
擷取程式碼如下:
<html>
<head>
<title>JS串口操作</title>
<script type="text/javascript">
function OpenPort()
{
if(MSComm1.PortOpen==false)
{
MSComm1.PortOpen=true;
alert("開啟");
}
else if(MSComm1.PortOpen==true)
{
alert("已開啟");
}
else
{
alert("失敗");
}
}
function ClosePort(){
if (MSComm1.PortOpen)
{
MSComm1.PortOpen = false;
alert("closed")
}
else
{
alert("already close!");
}
}
</script>
</head>
<OBJECT CLASSID="clsid:648A5600-2C6E-101B-82B6-000000000014" id=MSComm1 codebase="MSCOMM32.OCX" type="application/x-oleobject" style="LEFT: 54px; TOP: 14px;display:none;">
<PARAM NAME="CommPort" VALUE="1">
<PARAM NAME="DataBits" VALUE="8">
<PARAM NAME="StopBits" VALUE="1">
<PARAM NAME="BaudRate" VALUE="9600">
<PARAM NAME="Settings" VALUE="9600,N,8,1">
<PARAM NAME="RTSEnable" VALUE="1">
<PARAM NAME="DTREnable" VALUE="1">
<PARAM NAME="Handshaking" VALUE="0">
<PARAM NAME="NullDiscard" VALUE="0">
<PARAM NAME="ParityReplace" VALUE="?">
<PARAM NAME="EOFEnable" VALUE="0">
<PARAM NAME="InputMode" VALUE="0">
<PARAM NAME="InBufferSize" VALUE="1024">
<PARAM NAME="InputLen" VALUE="0">
<PARAM NAME="OutBufferSize" VALUE="512">
<PARAM NAME="SThreshold" VALUE="0">
<PARAM NAME="RThreshold" VALUE="0">
</OBJECT>
<body>
<input type="button" value="發送測試"/>
<input type="button" value=" 關閉"/>
</body>
</html>
頁:
[1]