• 文字广告位
  • 文字广告位
  • 文字广告位
您现在的位置: 站长手册 >> 特效代码 >> 鼠标类 >> 正文
站内搜索
Google
[图文]记录鼠标移动并可回放的脚本
          ★★★★   

记录鼠标移动并可回放的脚本

雅虎收藏夹 百度收藏 Google书签 Yahoo书签 新浪ViVi 搜狐网摘 365Key网摘 天极网摘 diglog 和讯网摘 POCO网摘 YouNote网摘 博拉网 天下图摘 Del.icio.us digg reddit spurl BlinkList blogmarks
人气: 来源:网络 作者:佚名 所属栏目:鼠标类 [切换到繁體中文]
介绍:用来记录鼠标移动的位置,可以快放、慢放、倒放。

演示:

[Ctrl+A全选 提示:你可先修改部分代码,再按运行]

下面教你如何应用此特效:
 --------------------------------------------------------------------------------------
  需要在<body 这里>加入的代码:onmousemove="follow()"
 --------------------------------------------------------------------------------------
以下代码加到<head>…</head>中
以下代码加到<body>…</body>中
<script language="JavaScript">
<!--
var mousex=new Array();
var mousey=new Array();
var i;
var j=0;
var k;
var recordcount=0;
var repeat;
var repeat2;
var repeat3;
var speed=50;

function startthis() {
recordcount=1;
i=0;
mousex=new Array();
mousey=new Array();
recordthis();
}

function recordthis() {
if (maxnum.value=='' || isNaN(maxnum.value) == true || maxnum.value<0) {
 if (recordcount==1) {
 mousex[i]=mousefollow.offsetLeft;
 mousey[i]=mousefollow.offsetTop;
 i++;
 k=i;
 textfield.value='无时间限制';
 }
}
else {
 if (recordcount==1) {
  if (i<maxnum.value) {
  mousex[i]=mousefollow.offsetLeft;
  mousey[i]=mousefollow.offsetTop;
  i++;
  k=i;
  textfield.value='剩余'+(maxnum.value-i)+'/50秒';
  }
  else {
  recordcount=0;
  textfield.value='时间到';}
  }
 }
repeat=setTimeout("recordthis()",20);
}

function stopthis() {
clearTimeout("repeat");
recordcount=0;
}

function playthis() {
clearTimeout("repeat");
clearTimeout("repeat3");
recordcount=0;
if (j<i-1) {
 arrow.style.pixelLeft=mousex[j];
 arrow.style.pixelTop=mousey[j];
 arrow.style.visibility='visible';
 j++;
 repeat2=setTimeout("playthis()",speed);
 }
else {clearTimeout("repeat2");
 arrow.style.visibility='hidden';
 j=0;
 }
}

function rewindthis() {
clearTimeout("repeat");
clearTimeout("repeat2");
recordcount=0;
if (k>0) {
 arrow.style.pixelLeft=mousex[k-1];
 arrow.style.pixelTop=mousey[k-1];
 arrow.style.visibility='visible';
 k--;
 repeat3=setTimeout("rewindthis()",speed);
 }
else {clearTimeout("repeat3");
 arrow.style.visibility='hidden';
 k=i;
 }
}

function follow() {
mousefollow.style.pixelLeft=document.body.scrollLeft+event.clientX;
mousefollow.style.pixelTop=document.body.scrollTop+event.clientY;
}
// -->
</script>

<div id="arrow" style="position:absolute; width:12px; height:21px; z-index:1;visibility:hidden"><img src="/texiao/zzsc_demo/arrow.gif" width="12" height="21"></div>
<div id="mousefollow" style="position:absolute; width:12px; height:21px; z-index:1;visibility:hidden"> </div>
<input type="text" name="maxnum" size="4" maxlength="4"><input type=button onclick=startthis() value=录制><input type=button onclick=stopthis() value=停止><input type=button onclick="speed=50;playthis()" value=播放><input type=button onclick="speed=10;playthis()" value=快放><input type=button onclick="speed=150;playthis()" value=慢放><input type=button onclick="speed=50;rewindthis()" value=倒放><input type="button" name="textfield" style="width:100px" value="无时间限制">
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
姓 名: *(必填项) ·注册用户·
Email: QQ号:
评 分: 1分 2分 3分 4分 5分
  • 您可以发表评论支持你喜欢的文章。
  • 请遵守《互联网电子公告服务管理规定》
  • 请遵守中华人民共和国各项有关法律法规。
  • 严禁发表危害国家安全、政治、黄色淫秽等内容的评论。
  • 评论人需对自己在使用评论过程中的行为承担法律责任。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表个人观点,与本网站立场无关。
站内特效搜索
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | | 京ICP备 05004866号 |
版权所有 2007-2008 站长手册 WWW.ZZSC.ORG 业务联系 zzsc.org#gmail.com