小R科技-WIFI机器人网·机器人创意工作室

 找回密码
 立即注册
查看: 4800|回复: 1

javascript

[复制链接]
发表于 2014-9-6 08:14:15 | 显示全部楼层 |阅读模式
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MJPEG-Streamer</title>
</head>
<script type="text/javascript">


var imageNr = 0; // Serial number of current image
var finished = new Array(); // References to img objects which have finished downloading
var paused = false;

function sendSer(value)
   {
       document.getElementById("ser").src="/www/cgi-bin/wificar?"+value;   
   }

function createImageLayer() {
  var img = new Image();
  img.style.position = "absolute";
  img.style.zIndex = -1;
  img.onload = imageOnload;
  img.onclick = imageOnclick;
  img.src = "/?action=snapshot&n=" + (++imageNr);
  var webcam = document.getElementById("webcam");
  webcam.insertBefore(img, webcam.firstChild);
}

// Two layers are always present (except at the very beginning), to avoid flicker
function imageOnload() {
  this.style.zIndex = imageNr; // Image finished, bring to front!
  while (1 < finished.length) {
    var del = finished.shift(); // Delete old image(s) from document
    del.parentNode.removeChild(del);
  }
  finished.push(this);
  if (!paused) createImageLayer();
}

function imageOnclick() { // Clicking on the image will pause the stream
  paused = !paused;
  if (!paused) createImageLayer();
}

</script>
<div style="float:left">
<table>
<tr><img id="ser" width="1" height="1"></tr>
<tr><td colspan="3" align="middle">
    <input type="button" style="height:100px; width:100px" value="U"/></td>
</tr>
<tr>
    <td><input type="button" style="height:100px; width:100px" value="L" /></td>
    <td><input type="button" style="height:100px; width:100px" value="R" /></td>
</tr>
<tr><td colspan="3" align="middle">
    <input type="button"  style="height:100px;width:100px;" value="T"/></td>
</tr>
<tr><td colspan="3" align="middle">
    <input type="button"  style="height:100px;width:100px;" value="D"/></td>
</tr>
</table>
</div>

<div style="float:left">
    <body>
        <div id="webcam"><noscript><img src="/?action=snapshot" /></noscript></div>

    </body>
</div>
</html>


wificar的程序是
#!/usr/bin/lua
io.output("/dev/tttyATH0")
io.write("os.getenv("QUERY_STRING")")



这是哪错了?串口没信号输出。点击按钮的时候,感觉onclick事件没有触发。。。卡这了。。

回复

使用道具 举报

 楼主| 发表于 2014-9-6 21:28:10 | 显示全部楼层
自解:在sendSer函数中徐添加地址document.getElementById("ser").src="http://192.168.1.2/cgi-bin/wificar?"+value;  
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

新品特惠推荐上一条 /2 下一条

QQ|QQ技术咨询1|QQ技术咨询2|商务合作微信1:xiaorgeek001|商务合作微信2:XiaoRGEEK|诚聘英才|Archiver|手机版|小R科技-WIFI机器人网·机器人创意工作室 ( 粤ICP备15000788号-6 )

GMT+8, 2025-2-5 22:09 , Processed in 1.073632 second(s), 18 queries .

Powered by XiaoR GEEK X3.4

© 2014-2021 XiaoR GEEK

快速回复 返回顶部 返回列表