当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 懒就要懒到底:鼠标自动点击(含时间判断)

Javascript
javascript IFrame 强制刷新代码
JQuery 学习笔记 选择器之一
JQuery 学习笔记 选择器之二
JQuery 学习笔记 选择器之三
JQuery 学习笔记 element属性控制
Prototype 工具函数 学习
Prototype Selector对象学习
用JQuery 实现AJAX加载XML并解析的脚本
jquery 表单下所有元素的隐藏
javascript 动态table添加colspan\rowspan 参数的方法
利用javascript/jquery对上传文件格式过滤的方法
javaScript 判断字符串是否为数字的简单方法
jquery 将disabled的元素置为enabled的三种方法
javascript 解析后的xml对象的读取方法细解
IE中radio 或checkbox的checked属性初始状态下不能选中显示问题
javascript 一个函数对同一元素的多个事件响应
对象特征检测法判断浏览器对javascript对象的支持
javaScript Array(数组)相关方法简述
js 字符串操作函数
JavaScript中null与undefined分析

Javascript 中的 懒就要懒到底:鼠标自动点击(含时间判断)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 335 ::
收藏到网摘: n/a

其实老早之前就已经做完了,这次稍微改进一下
浏览地址:http://www.healdream.com/upload/html/autoclick.html
复制代码 代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="yahoo.js" type="text/javascript"></script>
<script src="event.js" type="text/javascript"></script>
</head>
<body>
<p><a href="http://www.blueidea.com">鼠标放在这个链接上1.5秒以上,将进入蓝色理想网站,当然不到1.5秒就没有效果</a></p>
<p><a href="http://www.healdream.com/blog">同理移到这里将进入我的blog</a></p>
<script type="text/javascript">
var links=document.getElementsByTagName("a");
function return_obj(){
return source;
}
function auto_click(str){
window.location=str;
}
function mouseover_func(e){
source=event.srcElement;
start=setTimeout("auto_click('"+source+"')",1500);
}
function mouseout_func(e){
clearInterval(start);
}
YAHOO.util.Event.addListener(links,"mouseover",mouseover_func);
YAHOO.util.Event.addListener(links,"mouseout",mouseout_func);
</script>
</body>
</html>