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

Javascript
JavaScript如何重构嵌套循环和递归
JS应用在Firebug中的扩展架构模式
提升JS性能:将递归转换为迭代
IE7浏览器下缩放图片失真问题
JavaScript对DOM进行操作的指导性原则
JavaScript有趣实例:胸罩罩杯尺寸计算器
Firefox的Firebug扩展:FireScope
Mozilla的JavaScript引擎__noSuchMethod__()方法
JavaScript+CSS制作的网站导航菜单
javascript的私有成员(private)
Javascript绘制分析曲线图
ie6使用js支持hover伪类
收集的25个下拉网页菜单特效Javascript脚本
Javascript框架的自定义事件
总结Javascript调用函数的方法
JS教程:call、apply、callee用法
JS教程:数组类型检测和集合检测
兼容FF的设为首页与收藏网站的JS代码
Javascript教程:PopUp对象
JS读写Cookie以及设置过期时间

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 191 ::
收藏到网摘: 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>