----time.pl----
#!/usr/bin/perl
use strict;
print 'Content-Type: text/html', "\n\n";
my ($ss, $mn, $hh, $dd, $mm, $yy) = localtime(time);
$yy += 1900;
$mm++;
my $my_time = sprintf("%04d.%02d.%02d %02d:%02d:%02d", $yy, $mm, $dd, $hh, $mn, $ss);
print $my_time;
---end---
<html>
<head>
<script type="text/javascript" src="./js/prototype-1.5.0.js"></script>
<script type="text/javascript">
//<![CDATA[
function updateResult(req){
$("status").innerHTML = req.responseText ;
}
function update() {
var url = './time.pl';
var params = 'c=time';// つかわないが。。
var ajax = new Ajax.Request(url, { method: 'post',
parameters: params,
onComplete: updateResult
});
}
function adListener() {
periodicalExecuter = new PeriodicalExecuter(update, 1);
}
//]]>
</script>
</head>
<body onload="adListener()">
time :
<span id="status"></span>
</body>
</html>
No comments:
Post a Comment