Home > Chỉ dẫn lập trình > Show time on server

Show time on server

<?php $rfc = date(‘r’, time()); ?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
    <head>
        <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
        <title>Time on server</title>
    </head>
<body>
<div id=”server_time”>Loading…</div>
<script type=”text/javascript”>
var rfc = new Date(‘<?php echo $rfc; ?>’);
function countUp() {
    document.getElementById(‘server_time’).innerHTML = rfc;
    rfc.setTime(rfc.getTime() + 1000);
    setTimeout(‘countUp()’, 1000);
}
countUp();
</script>
</body>
</html>

Demo Example

Categories: Chỉ dẫn lập trình Tags:
  1. Chưa có bình luận nào.
Content (You can use Yahoo! Messenger Emoticons :D = smile)
Captcha