为你的 Blog 添加“跟随鼠标的文字”功能。
2004-07-09 16:11
471 查看
在“选项”->“配置”的“静态新闻/声明”中加入下面的语句就可以了:
<style type="text/css">
.spanstyle
{
position:absolute;
visibility:visible;
top:-500px;
font-size:10pt;
color: #0000ff;
font-weight:bold;
}
</style>
<script>
var x,y
var step=15
var flag=0
var message="欢迎您亲自光临铁拳的小站"
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length;i++)
{
xpos[i]=-500
}
var ypos=new Array()
for (i=0;i<=message.length;i++)
{
ypos[i]=-500
}
function handlerMM(e)
{
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX-5
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY-75
flag=1
}
function makesnake()
{
if (flag==1 && document.all)
{
for (i=message.length; 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; i++)
{
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if (flag==1 && document.layers)
{
for (i=message.length; 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; i++)
{
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("makesnake()",30)
}
</script>
<body onLoad="makesnake()" >
<script>
for (i=0;i<=message.length;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;
</script>
<style type="text/css">
.spanstyle
{
position:absolute;
visibility:visible;
top:-500px;
font-size:10pt;
color: #0000ff;
font-weight:bold;
}
</style>
<script>
var x,y
var step=15
var flag=0
var message="欢迎您亲自光临铁拳的小站"
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length;i++)
{
xpos[i]=-500
}
var ypos=new Array()
for (i=0;i<=message.length;i++)
{
ypos[i]=-500
}
function handlerMM(e)
{
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX-5
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY-75
flag=1
}
function makesnake()
{
if (flag==1 && document.all)
{
for (i=message.length; 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; i++)
{
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if (flag==1 && document.layers)
{
for (i=message.length; 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; i++)
{
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("makesnake()",30)
}
</script>
<body onLoad="makesnake()" >
<script>
for (i=0;i<=message.length;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;
</script>
相关文章推荐
- 给blog添加效果(计数器、天气预报、跟随鼠标的萤火虫、跟随鼠标的文字、状态栏文本、副标题格言等)
- 整理帖:给blog添加效果(计数器、天气预报、精美flash时钟、跟随鼠标的萤火虫、跟随鼠标的文字、状态栏文本、副标题格言等)
- 给blog添加效果(计数器、天气预报、精美flash时钟、跟随鼠标的萤火虫、跟随鼠标的文字、状态栏文本、副标题格言等)
- 给blog添加效果(计数器、天气预报、精美flash时钟、跟随鼠标的萤火虫、跟随鼠标的文字、状态栏文本、副标
- 整理帖:给blog添加效果(计数器、天气预报、精美flash时钟、跟随鼠标的萤火虫、跟随鼠标的文字、状态栏文本、副标题格言等)
- 整理帖:给blog添加效果(计数器、天气预报、精美flash时钟、跟随鼠标的萤火虫、跟随鼠标的文字、状态栏文本、副标题格言等)
- [zt]为你的 Blog 添加“天气预报”功能。
- 为你的 Blog 添加“天气预报”功能。
- 为你的 Blog 添加“天气预报”功能。
- [转改]为你的 Blog 添加“天气预报”功能。
- 为你的blog添加搜索功能
- 模仿bootstrap做的 js tooltip (添加鼠标跟随功能)
- 为你的blog添加搜索功能
- 为你的blog添加选中翻译的功能
- 为你的 Blog 添加“状态栏文本”功能。
- 为你的 Blog 添加“天气预报”功能。
- 为你的CSDN博客添加CNZZ流量统计功能
- jQuery+css3实现文字跟随鼠标的上下抖动
- 鼠标文字跟随
- JavaScript:一个鼠标动态跟随文字特效的示例