88 lines
2.6 KiB
Plaintext
88 lines
2.6 KiB
Plaintext
|
|
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<!-- Meta, title, CSS, favicons, etc. -->
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<!-- jQuery -->
|
|
<script src="../vendors/jquery/dist/jquery.min.js"></script>
|
|
<title>Wallboard Test</title>
|
|
<script>
|
|
var ws;
|
|
|
|
//"웹소켓 접속" 버튼을 클릭했을때
|
|
function btnLogin_onclick() {
|
|
//웹소켓을 지원하는 브라우저이면
|
|
if ("WebSocket" in window) {
|
|
//웹소켓 서버에 접속한다.
|
|
ws = new WebSocket("ws://172.168.1.218:14003");
|
|
var randomId = Math.floor(Math.random() * 10000) + 1;
|
|
//웹소켓이 접속되었음.
|
|
ws.onopen = function() {
|
|
var sendstr = "REGIST|" + "WALBD^"+ randomId;
|
|
ws.send(sendstr);
|
|
};
|
|
//웹소켓 서버에서 메세지가 전송되었음.
|
|
ws.onmessage = function(evt) {
|
|
document.getElementById("callData").value = evt.data;
|
|
|
|
};
|
|
//웹소켓이 종료되었음.
|
|
ws.onclose = function() {
|
|
};
|
|
//웹소켓 접속중 에러가 발생하였음.
|
|
ws.onerror = function(e) {
|
|
alert("Server error:" + e);
|
|
};
|
|
|
|
} else {
|
|
alert("브라우저가 웹소켓을 지원하지 않습니다.");
|
|
}
|
|
}
|
|
|
|
//소켓 접속후 레지스트를 한다.
|
|
function onOpenFunction(){
|
|
btnLogin_onclick();
|
|
}
|
|
|
|
function onCloseFunction(){
|
|
ws.close();
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body onload="onOpenFunction();" onunload="onCloseFunction();" style="background-color:#ccfff1; width: 100%;height: 100%; margin : 0 0 0 0;">
|
|
<input type="hidden" id="callData"/>
|
|
<div id="main" style="width: 100%; height:100vh; margin : 0 0 0 0; overflow: hidden;">
|
|
</div>
|
|
</body>
|
|
<script type="text/javascript">
|
|
var screenNo = "1";
|
|
function get_timer1(){
|
|
// $("#main").load("http://172.168.1.218/I4WAY_DashBoard_V1/html/index2.html");
|
|
|
|
// 함수값 불러와서, 태그 안에 집어넣기.
|
|
if(screenNo == "1"){
|
|
screenNo = "2";
|
|
$("#main").load("http://172.168.1.218/I4WAY_DashBoard_V1/html/index2.html");
|
|
}else if(screenNo == "2"){
|
|
screenNo = "3";
|
|
$("#main").load("http://172.168.1.218/I4WAY_DashBoard_V1/html/index3.html");
|
|
}else if(screenNo == "3"){
|
|
screenNo = "1";
|
|
$("#main").load("http://172.168.1.218/I4WAY_DashBoard_V1/html/index4.html");
|
|
}else{
|
|
screenNo = "1";
|
|
}
|
|
// 1000 밀리초(=1초) 후에, 이 함수를 실행하기 (반복 실행 효과).
|
|
setTimeout( "get_timer1()", 20000 );
|
|
|
|
}
|
|
|
|
// (페이지가 열리자마자) 함수를 불러오기.
|
|
var callFunction = get_timer1();
|
|
</script>
|
|
</html> |