35、页面停留时间B
类别: JavaScript教程
====1、将以下代码加入HEML的<body></body>之间:
<script LANGUAGE="Javascript">
<!-- Begin
pageOpen = new Date();
function bye() {
pageClose = new Date();
minutes = (pageClose.getMinutes() - pageOpen.getMinutes());
seconds = (pageClose.getSeconds() - pageOpen.getSeconds());
time = (seconds + (minutes * 60));
if (time == 1) {
time = (time + " second");
}
else {
time = (time + " seconds");
}
alert(\'您在本页停留了\' + time + \'.谢谢!!\');
}
// End -->
</script>
<body onUnload="bye()">
<script LANGUAGE="Javascript">
<!-- Begin
pageOpen = new Date();
function bye() {
pageClose = new Date();
minutes = (pageClose.getMinutes() - pageOpen.getMinutes());
seconds = (pageClose.getSeconds() - pageOpen.getSeconds());
time = (seconds + (minutes * 60));
if (time == 1) {
time = (time + " second");
}
else {
time = (time + " seconds");
}
alert(\'您在本页停留了\' + time + \'.谢谢!!\');
}
// End -->
</script>
<body onUnload="bye()">
- 上一篇: 34、页面停留时间A
- 下一篇: 36、自动调用不同音乐
-= 资 源 教 程 =-
文 章 搜 索