我希望能让我的网页变得更加生动或交互式,比如定期刷新数据并进行监测或分析等操作。例如,谷歌的speedtracer... 有很多api可以绘制静态图表,例如jFreeChart,但我想要它能够定期刷新。虽然使用轮询也可以实现,但会影响网站的外观,并且需要耗费时间才能使效果反映到用户。是否有可能使用javascript、jQuery或其他可用的api在网页上实现这一功能呢?谢谢。
我正在为我开发的系统制作一个统计页面,虽然我使用PHP调用页面刷新,但你也可以像这样刷新你的页面:
<!-- Codes by Quackit.com -->
<html>
<head>
<script type="text/JavaScript"></script>
</head>
<body onload="JavaScript:timedRefresh(5000);">
<p>This page will refresh every 5 seconds. This is because we're using the 'onload' event to call our function. We are passing in the value '5000', which equals 5 seconds.</p>
<p>But hey, try not to annoy your users too much with unnecessary page refreshes every few seconds!</p>
</body>
</html>