>
设为首页
>
收藏本站
>
最新电影
首页
运营资讯
今日英语
图形图像
计算机技术
Asp编程
网站结构化
资源共享
休闲娱乐
访问新站
您现在的位置:
首页
=>
后台技术
=>
脚本特效
=>
鼠标特效
订阅本栏目
跟随鼠标的图片
时间: 2007-10-01 09:41:18 阅读次数:2148
<html> <head> <title>网页特效|Linkweb.cn/Js|---跟随鼠标的图片</title> <meta http-equiv="Content-Type" c> </head> <body id="mybody" bgcolor="#FFFFFF" cellpadding="0"cellspacing="0" width="500" align="center"> <table width="520"> <tr> <td align="left" width="512" valign="top"> <p align="center"></td> <td align="left" valign="top" width="5"><script> picFollow = new Image(); picFollow.src = "/imagesjs/heart.gif"; picolimpic = new Image(); picolimpic.src = "/imagesjs/love.gif"; document.onmousemove = getMousePosition; document.onmouseout = pauseheart; document.write("<div id=\"diva\" style=\"position:absolute\">"); document.write("<img name=\"pic\"src=" + picFollow.src + "></div>"); var picX = 20; var picY = 100; var step = 10; var speed = 10; var tolerance = step/2 +1; var mouseX = 0; var mouseY = 0; var mouseOut = true; var followMouse = false; myInterval = setInterval('moveheart()', speed); function pauseheart() { mouseOut = true; } function getMousePosition(e) { mouseX = window.event.x + document.body.scrollLeft; mouseY = window.event.y + document.body.scrollTop; mouseOut = false; if (followMouse) { diva.style.left = mouseX - pic.width / 2; diva.style.top = mouseY - pic.height / 2; } } function calcNewPos() { if (mouseX == picX) return; arg = (mouseY-picY) / (mouseX-picX); mult = 1; if (mouseX - picX < 0) mult = -1; alpha = Math.atan(arg); dx = mult * step * Math.cos(alpha); dy = mult * step * Math.sin(alpha); picX += dx; picY += dy; } function collision() { if ((Math.abs(picX-mouseX) < tolerance) && (Math.abs(picY-mouseY) < tolerance) && (!mouseOut)) return true; return false; } function moveheart() { calcNewPos(); window.status = "("+mouseX+","+mouseY+")"; diva.style.left = picX - pic.width / 2; diva.style.top = picY - pic.height / 2; if (collision()) { clearInterval(myInterval); pic.src = picolimpic.src; followMouse = true; mybody.style.cursor="hand" } } </script></td> </tr> </table> <table> <tbody> <script language="Javascript"> <!-- function selectAll(theField){ var tempval=eval("document."+theField) tempval.focus() tempval.select() } //--> </script> <table border="0" cellpadding="0" cellspacing="0" width="500" align="center"> <tr> </tr> </table> <table width="100%"> <tr> </tr> </table> <table width="100%"> <tr> </tr> </table> </body>
提示:您可以先修改部分代码再运行
飞飞Asp技~术乐园
站内搜索
:
标题
内容
下一篇
显示鼠标坐标信息
上一篇
Windows自定义鼠标
本栏目最新
栏目最新列表
带箭头的漂亮的鼠标跟随提示信息
鼠标跟随提示信息
页面黑客帝国效果
鼠标紧随的流动彩色字串
鼠标围绕盘旋的鸟
网站优化策划
栏目最新列表
增加网站外链的快速方法
网站上线前必做的30个检查
新的友情链接参考标准(没有google的PR情况
优化Google的AdSense广告的五个工具
王通讲SEO八大基础
站点最新
站点最新列表
微博推广的一些技巧
xhEditor v1.1.7 发布,
收集的一些轻量级非常实
50个新鲜兼容最新版本的
javascript中cookie的设
Excel中出现#VALUE!、#D
jquery插件:飞飞表情插件
十个使用HTML5开发的精彩
支持HTML5的浏览器有哪些
飞妮莫属:漫画:如何写出
历史最热10条信息
MIME介绍 及
[
1
] [
2
] [
3
]
巧用Google和迅雷来下载
Transact SQL 常
[
1
] [
2
]
VIA Rhine II Fast Ethe
电脑常用端
[
1
] [
2
] [
3
]
Do you get a kick out
十道羊皮卷 欣赏+mp3版+
每日一句:A friend and
每日一句:Theres no tu
经典__悟透JavaScript
伟哥博客
西安房产
123最新电影
三四六四
关于站点
|
免责声明
|
联系站长
|
网站地图
|
陕ICP备07002804号
WEB技术QQ交流群:72840059
©2007 ffasp.com. 版权所有