疑問

日付と時間を表示したい

処理

挿入-その他-スクリプト

スクリプトのライブラリから「日付と時間を表示します」を選択し、ダブルクリック、右クリックでスクリプトの挿入、右ウィンドウにドロップのいずれかで右の上下に表示されます。上は<head></head>間の記述、下が<body></body>内の記述を表します。

スクリーンショット

スタイルの設定

スクリプト

<head></head>間

<script language="JavaScript">
<!--HPB_SCRIPT_CODE_40
var _hcsjtmrID = null;
var _hcsjtmrON = false;

function _HpbDaysJpl()
{
  this[0] = "日"; this[1] = "月"; this[2] = "火"; this[3] = "水";
  this[4] = "木"; this[5] = "金"; this[6] = "土";
}
  
function _HpbClockStatusJpl()
{
  if (_hcsjtmrON)
  {
    window.clearTimeout(_hcsjtmrID);
    _hcsjtmrON = false;
  }

  var now = new Date();
  var yr  = now.getYear();
  var mn  = now.getMonth() + 1;
  var dt  = now.getDate();
  var dy  = now.getDay();
  var hh  = now.getHours();
  var mm  = now.getMinutes();
  var ss  = now.getSeconds();

  var fyr = (yr < 1900) ? 1900 + yr : yr;

  var dys = new _HpbDaysJpl();
  var dyj = dys[dy];

  var msg  = fyr + "年" + mn + "月" + dt + "日" + "(" + dyj + ") ";
      msg +=  hh + "時" + mm + "分" + ss + "秒";

  window.status = msg;

  _hcsjtmrID = window.setTimeout("_HpbClockStatusJpl()", 1000);
  _hcsjtmrON = true;
}
//-->
</script>

body内

<script language="JavaScript">
<!--
_HpbClockStatusJpl();
-->
</script>