2013-10-31
展开全部
<HTML>
<HEAD>
<TITLE>鼠标特效篇--文本跟随鼠标</TITLE>
</HEAD>
<BODY bgcolor="#fef4d2" onload=MouseText()>
<br><br>
<center>
<font color="red"><h2>鼠标特效篇--文本跟随鼠标</h2></font>
<hr width=300>
<br><br>
<!-- 案例代码1开始 -->
<script language=JavaScript>
var x,y
var step=18
var index=0
<!-- [Step1]: 这里可以更改跟随鼠标的文本信息 -->
var message="鼠标特效篇--文本跟随鼠标!!"
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) { xpos[i]=-50 }
var ypos=new Array()
for (i=0;i<=message.length-1;i++) { ypos[i]=-200 }
function MouseText() {
if (index==1 && document.all) {
for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step; ypos[i]=ypos[i-1] }
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) { var thisspan = eval("span"+(i)+".style"); thisspan.posLeft=xpos[i]; thisspan.posTop=ypos[i] }
}
else if (index==1 && document.layers) {
for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step; ypos[i]=ypos[i-1] }
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) { var thisspan = eval("document.span"+i); thisspan.left=xpos[i]; thisspan.top=ypos[i] }
}
<!-- [Step2]: 在此能够设置文本的速度,数值大速度慢 -->
var timer=setTimeout("MouseText()",30)
}
function MouseScroll(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
index=1
}
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){ document.captureEvents(Event.mousemove);}
document.onmousemove = MouseScroll;
</script>
<!-- 案例代码1结束 -->
<!-- 案例代码2开始 -->
<style type="text/css">
<!-- [Step3]: 这里可以更改文本的颜色 -->
.spanstyle { color: #ff0033; font-family: 宋体; font-size: 10pt; position: absolute; top: -50px; visibility: visible}
</style>
<!-- 案例代码2结束 -->
</BODY>
</HTML>
<HEAD>
<TITLE>鼠标特效篇--文本跟随鼠标</TITLE>
</HEAD>
<BODY bgcolor="#fef4d2" onload=MouseText()>
<br><br>
<center>
<font color="red"><h2>鼠标特效篇--文本跟随鼠标</h2></font>
<hr width=300>
<br><br>
<!-- 案例代码1开始 -->
<script language=JavaScript>
var x,y
var step=18
var index=0
<!-- [Step1]: 这里可以更改跟随鼠标的文本信息 -->
var message="鼠标特效篇--文本跟随鼠标!!"
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) { xpos[i]=-50 }
var ypos=new Array()
for (i=0;i<=message.length-1;i++) { ypos[i]=-200 }
function MouseText() {
if (index==1 && document.all) {
for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step; ypos[i]=ypos[i-1] }
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) { var thisspan = eval("span"+(i)+".style"); thisspan.posLeft=xpos[i]; thisspan.posTop=ypos[i] }
}
else if (index==1 && document.layers) {
for (i=message.length-1; i>=1; i--) { xpos[i]=xpos[i-1]+step; ypos[i]=ypos[i-1] }
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) { var thisspan = eval("document.span"+i); thisspan.left=xpos[i]; thisspan.top=ypos[i] }
}
<!-- [Step2]: 在此能够设置文本的速度,数值大速度慢 -->
var timer=setTimeout("MouseText()",30)
}
function MouseScroll(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
index=1
}
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){ document.captureEvents(Event.mousemove);}
document.onmousemove = MouseScroll;
</script>
<!-- 案例代码1结束 -->
<!-- 案例代码2开始 -->
<style type="text/css">
<!-- [Step3]: 这里可以更改文本的颜色 -->
.spanstyle { color: #ff0033; font-family: 宋体; font-size: 10pt; position: absolute; top: -50px; visibility: visible}
</style>
<!-- 案例代码2结束 -->
</BODY>
</HTML>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-31
展开全部
<SCRIPT LANGUAGE="JavaScript">
var msg='欢迎光临我的网站!';
var font='宋体';
var size=2;
var color='#996633';
var speed=.2;
var rotation=.2;
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
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;
xmouse = (ns)?evnt.pageX+20:event.x-20;
}
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(){
if (ie) outer.style.top=document.body.scrollTop;
currStep-=rotation;
for (i=0; i < n; i++){
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; }}
function drag(){
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();
setTimeout('drag()',10);}
if (ns||ie)window.onload=drag;
</SCRIPT>
var msg='欢迎光临我的网站!';
var font='宋体';
var size=2;
var color='#996633';
var speed=.2;
var rotation=.2;
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
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;
xmouse = (ns)?evnt.pageX+20:event.x-20;
}
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(){
if (ie) outer.style.top=document.body.scrollTop;
currStep-=rotation;
for (i=0; i < n; i++){
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; }}
function drag(){
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();
setTimeout('drag()',10);}
if (ns||ie)window.onload=drag;
</SCRIPT>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-31
展开全部
<SCRIPT LANGUAGE="JavaScript">
document.write('<STYLE>');
document.write('<!--');
document.write('.spanstyle {');
document.write('COLOR: #0066ff; FONT-FAMILY: 宋体; FONT-SIZE: 9pt; FONT-WEIGHT: normal; POSITION: absolute; TOP: -50px; VISIBILITY: visible');
document.write('}');
document.write('-->');
document.write('</STYLE>');
var message="你的文字写这里";
var x,y;
var step=12;
var flag=0;
message=message.split("");
var xpos=new Array();
for (i=0;i<=message.length-1;i++) {
xpos[i]=-50;
}
var ypos=new Array();
for (i=0;i<=message.length-1;i++) {
ypos[i]=-50;
}
function handlerMM(e) {
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX+10;
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY;
flag=1;
}
function makesnake() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step;
ypos[i]=ypos[i-1];
}
xpos[0]=x+step;
ypos[0]=y;
for (i=0; i<=message.length-1; i++) {
var thisspan = eval("span"+(i)+".style");
thisspan.posLeft=xpos[i];
thisspan.posTop=ypos[i];
thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() * 255 * 255 + Math.random() * 255;
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step;
ypos[i]=ypos[i-1];
}
xpos[0]=x+step;
ypos[0]=y;
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i);
thisspan.left=xpos[i];
thisspan.top=ypos[i];
thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() * 255 * 255 + Math.random() * 255;
}
}
}
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>");
document.write(message[i]);
document.write("</span>");
}
if (document.layers) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
function pageonload() {
makesnake();
window.setTimeout("pageonload();", 2);
}
pageonload()
</SCRIPT>
document.write('<STYLE>');
document.write('<!--');
document.write('.spanstyle {');
document.write('COLOR: #0066ff; FONT-FAMILY: 宋体; FONT-SIZE: 9pt; FONT-WEIGHT: normal; POSITION: absolute; TOP: -50px; VISIBILITY: visible');
document.write('}');
document.write('-->');
document.write('</STYLE>');
var message="你的文字写这里";
var x,y;
var step=12;
var flag=0;
message=message.split("");
var xpos=new Array();
for (i=0;i<=message.length-1;i++) {
xpos[i]=-50;
}
var ypos=new Array();
for (i=0;i<=message.length-1;i++) {
ypos[i]=-50;
}
function handlerMM(e) {
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX+10;
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY;
flag=1;
}
function makesnake() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step;
ypos[i]=ypos[i-1];
}
xpos[0]=x+step;
ypos[0]=y;
for (i=0; i<=message.length-1; i++) {
var thisspan = eval("span"+(i)+".style");
thisspan.posLeft=xpos[i];
thisspan.posTop=ypos[i];
thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() * 255 * 255 + Math.random() * 255;
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step;
ypos[i]=ypos[i-1];
}
xpos[0]=x+step;
ypos[0]=y;
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i);
thisspan.left=xpos[i];
thisspan.top=ypos[i];
thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() * 255 * 255 + Math.random() * 255;
}
}
}
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>");
document.write(message[i]);
document.write("</span>");
}
if (document.layers) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
function pageonload() {
makesnake();
window.setTimeout("pageonload();", 2);
}
pageonload()
</SCRIPT>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-31
展开全部
http://www.yesky.com/imagesnew/software/jscript/index.html这里有很多特效!你自己看看先!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询