<!-- 引入文豆高拍仪JS接口--><scriptsrc="wdgpy.js"type="text/javascript"charset="utf-8"></script><scriptsrc="upload.js"type="text/javascript"></script><scripttype="text/javascript">varfileBase64Str=""; varfile_path=""; //时间格式化显示functionformatDate(time) { vardate=newDate(time); varyear=date.getFullYear(), month=date.getMonth() +1, day=date.getDate(), hour=date.getHours(), min=date.getMinutes(), sec=date.getSeconds(); varnewTime=year+ (month<10?'0'+month : month) + (day<10?'0'+day : day) + (hour<10?'0'+hour : hour) + (min<10?'0'+min : min) + (sec<10?'0'+sec : sec) ; returnnewTime; } functionsleep(milliSeconds) { varstartTime=newDate().getTime(); while (newDate().getTime() <startTime+milliSeconds); } functionShowInfo(op) { varobj=document.getElementById("TextInfo"); obj.value=obj.value+"\r\n"+op } /*---------------------------------------------------- ---返回获取的设备数目及设备名称 --- -----------------------------------------------------*/functionGetDevCountAndNameResultCB(devCount, devNameArr) { if (devCount>0) { varobj=document.getElementById("DevName"); obj.options.length=0; for (vari=0; i<devCount; i++) { varobjOption=document.createElement("option"); objOption.text=devNameArr[i]; objOption.value=i; obj.options.add(objOption); } obj.selectedIndex=0; varCamID=obj.selectedIndex; //获取分辨率Cam_GetDevResolution(CamID); } else { ShowInfo("没有发现合适的设备!"); } </script>
首先引入高拍仪js接口。
然后根据需求对照函数对功能进行删减。
functionreleaseSocketPro() { vardata=JSON.stringify({ 'function': 'releaseSocketPro' }); connected?sendMessage(data) : ConnectServer(sendMessage, data) } window.onbeforeunload=function () { Cam_Close(); //关闭高拍仪try { releaseSocketPro(); websocket.close(); websocket=null; } catch (ex) { } }; function$(id) { returndocument.getElementById(id); } functiontoSleep(milliSeconds) { varstartTime=newDate().getTime(); while (newDate().getTime() <startTime+milliSeconds); } functionaddEvent(obj, xEvent, fn) { if (obj.attachEvent) { obj.attachEvent('on'+xEvent, fn); } else { obj.addEventListener(xEvent, fn, false); } } functionInitCanvas(DivMainBox, mX, mY, mwidth, mheight) { if (mwidth!=0&&mheight!=0) { MainCanvas=document.createElement("canvas"); MainCanvas.style.border="solid 1px #A0A0A0"; MainCanvas.id="MainCamCanvas"; MainCanvas.width=mwidth; MainCanvas.height=mheight; MainContext=MainCanvas.getContext("2d"); DivMainBox.appendChild(MainCanvas); //添加画布MainCanvas.onmousedown=MainCanvasMouseDown; MainCanvas.onmousemove=MainCanvasMouseMove; MainCanvas.onmouseup=MainCanvasMouseUp; MainCanvas.onmouseout=MainCanvasMouseOut; addEvent(MainCanvas, 'mousewheel', onMouseWheel); addEvent(MainCanvas, 'DOMMouseScroll', onMouseWheel); } }
示例demo截图