サーバー側の日時を定期的に表示
XMLHttpRequest()でサーバー側の日時を定期的に表示する。取り合えず1秒間隔。
ポーリングはサーバー側で行っている(んだよな?)。
- clock.xul
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="clock.js"/> <button label="show clock" onclick="showClock();" /> <description id="desc">Clock</description> </window>
- clock.js
function showClock() { xmlhttp = new XMLHttpRequest(); if (xmlhttp) { xmlhttp.onreadystatechange = clock(); xmlhttp.send(null); } } function clock() { var now = new Date(); var watch = now.toLocaleString(); document.getElementById("desc").value = watch; setTimeout("clock()", 1000); }
サーバーのディスク空き容量監視とかできるかな。
JavaScriptでディスクの情報って取れるのだろうか。