大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 网页设计 -> 网页特效 -> 鼠标周围的文字宣传

鼠标周围的文字宣传

时间: 2021-07-31 作者:daque

把如次代码介入<body>地区中<script language="javascript1.2"><!--//

// your message herevar msg='welcome to ********';

var font='verdana,arial';var size=7; // up to sevenvar color='#ffcc33';

// this is not the rotation speed, its the reaction speed, keep low!// set this to 1 for just plain rotation w/out dragvar speed=.2;

// this is the rotation speed, set it negative if you want// it to spin clockwisevar rotation=.2;

// alter no variables past here!, unless you are good//---------------------------------------------------

var ns=(document.layers);var ie=(document.all);var msg=msg.split('');var n=msg.length; var a=size*15;var currstep=0;var ymouse=0;var xmouse=0;var scrll=0;var props="<font face="+font+" size="+size+" color="+color+">";

if (ie)window.pageyoffset=0

// writes the message if (ns){ for (i=0; i < n; i++)  document.write('<layer name="nsmsg'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+msg[i]+'</font></center></layer>'); } if (ie){  document.write('<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">');  for (i=0; i < n; i++)   document.write('<div id="iemsg" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center;font-weight:regular;cursor:default">'+props+msg[i]+'</font></div>');   document.write('</div></div>'); } (ns)?window.captureevents(event.mousemove):0;

function mouse(evnt){ ymouse = (ns)?evnt.pagey+20-(window.pageyoffset):event.y; // y-position xmouse = (ns)?evnt.pagex+20:event.x-20; // x-position}

if (ns||ie)(ns)?window.onmousemove=mouse:document.onmousemove=mouse;y=new array();x=new array();y=new array();x=new array();for (i=0; i < n; i++){ y[i]=0; x[i]=0; y[i]=0; x[i]=0;}

function makecircle(){ // rotation propertiesif (ie) outer.style.top=document.body.scrolltop;currstep-=rotation; for (i=0; i < n; i++){ // makes the circle  var d=(ns)?document.layers['nsmsg'+i]:iemsg[i].style;  d.top=y[i]+a*math.sin((currstep+i*1)/3.8)+window.pageyoffset-15;  d.left=x[i]+a*math.cos((currstep+i*1)/3.8)*2; // remove *2 for just a plain circle, not oval }}

function drag(){ // makes the resistance scrll=(ns)?window.pageyoffset:0; y[0]=math.round(y[0]+=((ymouse)-y[0])*speed); x[0]=math.round(x[0]+=((xmouse)-x[0])*speed); for (var i=1; i < n; i++){  y[i]=math.round(y[i]+=(y[i-1]-y[i])*speed);  x[i]=math.round(x[i]+=(x[i-1]-x[i])*speed);

 } makecircle(); // not rotation speed, leave at zero settimeout('drag()',10);}if (ns||ie)window.onload=drag;

// --></script>

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.