Web串口读取数据

本文介绍了如何在Web项目中实现串口数据的读取,主要通过使用ComAxCtrl.ocx ActiveX控件,并详细讲解了控件的下载与注册步骤,适用于解决浏览器读取串口数据的问题。
摘要由CSDN通过智能技术生成

项目开发中遇到的实际问题,需要从浏览器读取串口数据。网上查了很多资料。比较靠谱的整理了一下。

需要下载一个ComAxCtrl.ocx控件,然后将控件注册一下即可。

<!Doctype html>

<html>
<head>
    <title></title>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">

<style type="text/css">
body{
text-align: center;
font-size: 12px;
margin: 0px;
padding: 0px;
}
.clear{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
.cssCenter{
margin-top: 0px;
margin-bottom: 0px;
margin-left: auto;
margin-right: auto;
}
</style>
<script type="text/javascript">

var ComAxCtrl=null;

/**
* 检测是否允许ActiveX控件运行
* @param true-允许ActiveX控件运行;false-不允许ActiveX控件运行
*/
 function isActiveXEnabled() {
//xmlhttp对象
var kXmlHttp = null;  
//如果是IE浏览器
if ($.browser.msie!=null && $.browser.msie == true) {
//微软IE支持的xmlhttp对象
var aVersionhs = ["MSXML2.XMLHttp.5.0",
 
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值