[[ノート>ノート/ノート]]~
訪問者数 &counter(); 最終更新 &lastmod();
**Webブラウザで、画面を定期更新する方法 [#v1f588d1]
自動リロード機能のあるブラウザ
-sleipnir
-[[opera:http://jp.opera.com]] http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1414444874
HTMLのrefresh機能を使う~
[[例として:http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1123029996]]
<html>
<head>
<meta http-equiv="Refresh" content="15">
<title>☆☆☆</title>
</head>
<body>
<iframe src="http://www.yahoo.co.jp/" height=100% width=100%></iframe>
</body>
</html>
JavaScriptでタイマーを使う [[「Ajaxとタイマーを組み合わせると定期的にニュース情報を取得しページを更新することもできます」:http://www.openspc2.org/JavaScript/Ajax/Ajax_study/chapter05/012/index.html]] や [[アニメーションGIFもどき:http://www.red.oit-net.jp/tatsuya/java/anigif1.htm]] ~
[[最初の例:http://www.openspc2.org/JavaScript/Ajax/Ajax_study/chapter05/012/index.html]]
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Get Yahoo! NEWS</title>
<link rel="stylesheet" href="main.css" type="text/css" media="all">
<script type="text/javascript" src="xmlhttp.js"></script>
<script type="text/javascript"><!--
function getYNews()
{
httpObj = createXMLHttpRequest(displayData);
if (httpObj)
{
httpObj.open("GET","curl.rb?"+(new Date()).getTime(),true);
httpObj.send(null);
}
}
function displayData()
{
if ((httpObj.readyState == 4) && (httpObj.status == 200))
{
$("result").innerHTML = httpObj.responseText;
}
}
function setTimer()
{
timerID = setInterval("getYNews()",60 * 1000); // 60×1000ミリ秒 = 1分
getYNews();
}
function clearTimer()
{
clearInterval(timerID);
}
// --></script>
</head>
<body>
<h1>Get Yahoo! NEWS</h1>
<form method="get" name="ajaxForm" onsubmit="return false;">
<input type="button" value="Yahoo NEWS! 取得" onClick="setTimer()">
<input type="button" value="Yahoo NEWS! 更新解除" onClick="clearTimer()">
</form>
<div id="result">ボタンをクリックすると以後1分ごとにYahoo News!が表示/更新されます</div>
</body>
</html>