私の答えは、ASPやその他の言語に変更することは難しくありませんが、PHPとAjaxを使用しています。ヘッドボディに
<script type="text/javascript">
function Ajax()
{
var
$http,
$self = arguments.callee;
if (window.XMLHttpRequest) {
$http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
$http = new ActiveXObject('Msxml2.XMLHTTP');
} catch(e) {
$http = new ActiveXObject('Microsoft.XMLHTTP');
}
}
if ($http) {
$http.onreadystatechange = function()
{
if (/4|^complete$/.test($http.readyState)) {
document.getElementById('ReloadThis').innerHTML = $http.responseText;
setTimeout(function(){$self();}, 1000);
}
};
$http.open('GET', 'loadtxt.php' + '?' + new Date().getTime(), true);
$http.send(null);
}
}
</script>
で
<script type="text/javascript">
setTimeout(function() {Ajax();}, 1000);
</script>
<div id="ReloadThis">Default text</div>
</body>
今テキストファイル
<?php
$file = "error.txt";
$f = fopen($file, "r");
while ($line = fgets($f, 1000)) {
print $line;
}
?>
出典
2011-08-10 09:29:24
neo
関数ウィッヒの値を読み取るloadtxt.php使用ケビンが必要です'setInterval(Method、Duration) ' – reporter
jqueryの例とその実装方法を教えていただけますか? – dukevin
http://jquery-howto.blogspot.com/2009/04/ajax-update-content-every-x-seconds.html – Jon