게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
자바스크립트, html..잘아시는분 도움 부탁드립니다.
게시물ID : programmer_19538짧은주소 복사하기
작성자 : ▶◀바보온달
추천 : 0
조회수 : 508회
댓글수 : 2개
등록시간 : 2017/01/11 12:02:33
ping 체크하는 웹페이지를 만들고 있는데요...
아래 사진과 같이 표시 되게 하는것은 구했는데요...

보기 편하게 편집을 하려고 합니다.

11111.jpg


아래사진과 같이 편집을 하려고 합니다...
봐도 전혀 내용을 모르겠습니다..

도움부탁드립니다.



22222.jpg




제일 첫번째 사진 내용입니다.

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta name="robots" content="noindex, nofollow">
  <meta name="googlebot" content="noindex, nofollow">
  <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/knockout/2.2.1/knockout-min.js"></script>
  
<style type="text/css">

 A:link {text-decoration:none; color:#000080} 
 A:visited {text-decoration:none; color:#000080} 
 A:active {text-decoration:none; color:#000080} 
 A:hover {text-decoration:none; color:#000080} 

.OK {
    color:blue;
}
.checking,.unchecked {
    color:#FF8C00;
}
.Fail {
    color:red;
}

  </style>




<title>CCTV Ping Check</title>
<script type='text/javascript'>
window.onload=function(){
function ping(ip, callback) {

    if (!this.inUse) {
        this.status = 'unchecked';
        this.inUse = true;
        this.callback = callback;
        this.ip = ip;
        var _that = this;
        this.img = new Image();
        this.img.onload = function () {
            _that.inUse = false;
            _that.callback('responded');

        };
        this.img.onerror = function (e) {
            if (_that.inUse) {
                _that.inUse = false;
                _that.callback('OK', e);
            }

        };
        this.start = new Date().getTime();
        this.img.src = "http://" + ip;
        this.timer = setTimeout(function () {
            if (_that.inUse) {
                _that.inUse = false;
                _that.callback('Fail');
            }
        }, 1500);
    }
}
var PingModel = function (servers) {
    var self = this;
    var myServers = [];
    ko.utils.arrayForEach(servers, function (location) {
        myServers.push({
            name: location,
            status: ko.observable('unchecked')
        });
    });
    self.servers = ko.observableArray(myServers);
    ko.utils.arrayForEach(self.servers(), function (s) {
        s.status('checking');
        new ping(s.name, function (status, e) {
            s.status(status);
        });
    });
};
var komodel = new PingModel([




    '10.18.12.2',
    '10.18.14.10',
    '10.18.30.18',
    '10.18.30.26',
    '10.18.30.28',
    '10.18.30.30', 
    '10.18.30.31'
    ]);
ko.applyBindings(komodel);
}

</script>

  
</head>



<body>

  <ul data-bind="foreach:servers">
    <li> <a href="#" data-bind="text:name,attr:{href: 'http://'+name}">tester</a> <span data-bind="text:status,css:status"></span>
    </li>
</ul>

</body>

</html>

꼬릿말 보기
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호