var AutoClick = {
TimeoutID: null,
ClickTarget : null,
mouseover: function(ev) {
try {
var localName = ev.target.localName;
}catch(e) { }
if (localName.toLowerCase()=='a' && ev.target.
href.indexOf('javascript:')==-1) {
this.ClickTarget = ev.target;
this.TimeoutID = window.setTimeout(AutoClick
.autoclick, 2000);
}
},
mouseout: function(ev) {
this.ClickTarget = null;
if (this.TimeoutID) {
window.clearTimeout(this.TimeoutID);
this.TimeoutID = null;
}
},
click: function(ev) {
this.ClickTarget = null;
return ev.target ? true : false;
},
autoclick: function() {
if (!this.ClickTarget) return;
if (this.ClickTarget.target == '_blank')
gBrowser.loadOneTab(this.ClickTarget.href,
null, null, null, false, true);
else
loadURI(this.ClickTarget.href);
this.ClickTarget = null;
},
};
window.addEventListener('mouseover', AutoClick.mouseover, false);
window.addEventListener('mouseout', AutoClick.mouseout, false);
window.addEventListener('click', AutoClick.click, false);
网页停留多少时间代码:
<html>
<head>
<title>网页开源(www.51zjs.cn)- 网页停留时间代码</title>
<style type="text/css">
<!--
body { font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 4px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: none }
A:hover { COLOR: red; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active { font: 9pt "宋体"; cursor: hand; color: #FF0033 }
--></style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<br>
<br>
<center><font color=red face="隶书" size=6>时间按钮提醒</font></center>
<br>
<center>
<table border=0 bordercolor=blue borderlight=green style="border-collapse: collapse" cellpadding="0" cellspacing="0">
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面框中为脚本显示区</strong></font></td></tr>
<tr><td align=center>
<script LANGUAGE="JavaScript">
<!-- Begin
day = new Date();
miVisit = day.getTime();
function clock() {
today = new Date();
hrNow = today.getHours();
mnNow = today.getMinutes();
scNow = today.getSeconds();
miNow = today.getTime();
if (hrNow == 0) {
hour = 12;
ap = "AM";
} else if(hrNow <= 11) {
ap = "AM";
hour = hrNow;
} else if(hrNow == 12) {
ap = "PM";
hour = 12;
} else if (hrNow >= 13) {
hour = (hrNow - 12);
ap = "PM";
}
if (hrNow >= 13) {
hour = hrNow - 12;
}
if (mnNow <= 9) {
min = "0" + mnNow;
}
else (min = mnNow)
if (scNow <= 9) {
secs = "0" + scNow;
} else {
secs = scNow;
}
time = hour + ":" + min + ":" + secs + ap;
document.form.button.value = time;
setTimeout('clock()', 1000);
}
function timeInfo() {
milliSince = miNow;
milliNow = miNow - miVisit;
secsVisit = Math.round(milliNow / 1000);
minsVisit = (milliNow / 1000) / 60;
alert("给你提个醒: "
+ "你已经在本页面上停留了大约" + minsVisit + "分或"
+ secsVisit + "秒");
}
document.write("<left><form name=\"form\">"
+ "<input type=button value=\"Click for info!\""
+ " name=button onClick=\"timeInfo()\"></form></left>");
onError = null;
clock();
// End -->
</script>
</td></tr></table></center>
<br>
<br>
<center>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide
function goHist(a)
{
history.go(a);
}
//-->
</script>
</center>
<br>
<center>
<br>
<br>
</body>
</html>