只需浏览演示页面的源代码即可:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"
type="text/javascript"></script>
<script src="src/jquery.idletimer.js" type="text/javascript"></script>
<script src="src/jquery.idletimeout.js" type="text/javascript"></script>
<script type="text/javascript">
$.idleTimeout('#idletimeout', '#idletimeout a', {
idleAfter: 5,
pollingInterval: 2,
keepAliveURL: 'keepalive.php',
serverResponseEquals: 'OK',
onTimeout: function () {
$(this).slideUp();
window.location = "timeout.htm";
},
onIdle: function () {
$(this).slideDown(); // show the warning bar
},
onCountdown: function (counter) {
$(this).find("span").html(counter); // update the counter
},
onResume: function () {
$(this).slideUp(); // hide the warning bar
}
});
</script>