掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
ASP.NETのtimerについて (ID:111760)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
具体的とは? setInterval()関数は、お調べになりましたか? 何をさせるかは、現在、Timerで動かない・・・と言って おられる中身になりますが、実際のところ、この方法が インターフェースとして正しいかどうかは、何をさせる かで変化します。 ただ、Timerに代わるやり方としては・・・ <script language="javascript" type="text/javascript"> <!-- setInterval("ShowDateTime()",2000); function ShowDateTime(){ var now = new Date; var ji = new String(now.getHours()); var fun = new String(now.getMinutes()); switch (now.getMonth() + 1) { case 1: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " January," + now.getDate() + "," + now.getFullYear(); break; case 2: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " February," + now.getDate() + "," + now.getFullYear(); break; case 3: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " March," + now.getDate() + "," + now.getFullYear(); break; case 4: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " April," + now.getDate() + "," + now.getFullYear(); break; case 5: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " May," + now.getDate() + "," + now.getFullYear(); break; case 6: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " June," + now.getDate() + "," + now.getFullYear(); break; case 7: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " July," + now.getDate() + "," + now.getFullYear(); break; case 8: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " August," + now.getDate() + "," + now.getFullYear(); break; case 9: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " September," + now.getDate() + "," + now.getFullYear(); break; case 10: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " October," + now.getDate() + "," + now.getFullYear(); break; case 11: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " November," + now.getDate() + "," + now.getFullYear(); break; case 12: document.pdMENU.DateTime.value = (ji.length == 1 ? "0" + ji : ji) + ":" + (fun.length == 1 ? "0" + fun : fun) + " December," + now.getDate() + "," + now.getFullYear(); break; } delete fun; delete ji; delete now; } // --> </script> これを、ASP.NET での、Webフォームのデザインを開いた時の HTMLタブに記述することになります。 やっていることは、画面の右上に、日付・時刻表示を英語で行う と言うものですが・・・ 何がしたいかで、全く違うアプローチになったりします。 VB.NET側でDBアクセスを行い、その結果を渡す場合とか・・・ やりたいことが解りませんので、あくまで例としてのみです。 以上。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.