2017-09-07 13 views
3

自分の作品のカメラフィードを表示するためのウェブページを設定しようとしています。私たちは現在4台のカメラを持っており、別のカメラを手に入れています。あなたが想像しているように、5はウェブページにうまく収まらないでしょう。 iframeのx秒ごとのソースを変更するスクリプトを見つけたので、2つのフィードの間で1つのiframeを前後に切り替えることができます。しかし、このスクリプトでは、ソースが2回回転するたびに 'undefined'に変更されています。何か不足していますか?IframeはX秒ごとにsrcを変更します

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 
<title>Live Camera Feed</title> 
<link rel="stylesheet" href="style.css"> 

<script type="text/javascript"> 
var links = ["https://192.168.10.123/NW_Corner/push.php","https://192.168.10.123/NE_Corner/push.php"]; 
var i = 0; 
var renew = setInterval(function(){ 
    document.getElementById("frame").src = links[i];   
    if(links.length == i){ 
     i = 0; 
    } 
    else i++; 
},5000); 
</script> 

</head> 
<body> 

<table width="75%" height="75%"> 
    <tr> 
     <td><iframe width="1280" height="720" src="https://192.168.10.123/Driveway/push.php" width="75%" height="75%"></iframe></td> 
     <td><iframe width="1280" height="720" src="https://192.168.10.123/South_Door/push.php" width="75%" height="75%"></iframe></td> 
    </tr> 
    <tr> 
     <td><iframe id="frame" width="1280" height="720" src="https://192.168.10.123/NW_Corner/push.php" width="75%" height="75%"></iframe></td> 
     <td><iframe width="1280" height="720" src="https://192.168.10.123/NE_Corner/push.php" width="75%" height="75%"></iframe></td> 
    </tr> 
</table> 
</body> 
</html> 
+0

ここで問題は、ビューではまだ起こっていない要素を使用しようとしています。 '

関連する問題