2007/05/06 | 『推荐』博客特效代码大全
类别(偶尔创作) | 评论(3) | 阅读(266) | 发表于 13:22

                今天我终于把自己的博客改造成满意的样子啦!我在博客的顶部设置了一个“设为首页”和一个“收藏本站”。细心的朋友们还会看到下面的导航栏多了一条文字,嘿嘿。下面,我就来给大家介绍几个简单实用的代码吧!

1。

哈哈,点击过这个按钮的朋友们肯定都知道结果吧。想知道这么有趣的代码吗?让我来告诉你!

让屏幕抖动一阵  (以下是代码)

<input onclick="www_helpor_net(2)" type="button" value="地震啦!!!">
<script language="JavaScript">
<!--
function surfto(form) {
var myindex=form.select1.selectedIndex
if (form.select1.options[myindex].value != null) {
parent.main.location.href=form.select1.options[myindex].value;
}
}
// -->
</script>
<script language="JavaScript1.2">
<!--
function www_helpor_net(n) {
if (window.top.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
window.top.moveBy(0,i);
window.top.moveBy(i,0);
window.top.moveBy(0,-i);
window.top.moveBy(-i,0);
}
}
}
alert(" 没吓坏吧!!! ");
}
// -->
</script>
     

2。加入收藏夹 (以下是代码)

<span style="CURSOR: hand" onClick="window.external.addFavorite('你的网址','你的博客名称')" title="你的博客名称">收藏本站</span>
  

 效果见我的博客顶部 

3。设为首页  (以下是代码)

<span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('你的网址');" style="CURSOR: hand">设为首页</span>

4。状态栏的欢迎词 (以下是代码)

<script language="JavaScript">
<!--
function statusMessageObject(p,d) {
this.msg = MESSAGE
this.out = " "
this.pos = POSITION
this.delay = DELAY
this.i = 0
this.reset = clearMessage
}
function clearMessage() {
this.pos = POSITION
}
var POSITION = 100
var DELAY = 5
var MESSAGE = "你的欢迎词 "
var scroll = new statusMessageObject()
function scroller() {
for (scroll.i = 0; scroll.i < scroll.pos; scroll.i++) {
scroll.out += " "
}
if (scroll.pos >= 0)
scroll.out += scroll.msg
else scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length)
window.status = scroll.out
scroll.out = " "
scroll.pos--
if (scroll.pos < -(scroll.msg.length)) {
scroll.reset()
}
setTimeout ('scroller()',scroll.delay)
}
function snapIn(jumpSpaces,position) {
var msg = scroll.msg
var out = ""
for (var i=0; i<position; i++)
{out += msg.charAt(i)}
for (i=1;i<jumpSpaces;i++)
{out += " "}
out += msg.charAt(position)
window.status = out
if (jumpSpaces <= 1) {
position++
if (msg.charAt(position) == ' ')
{position++ }
jumpSpaces = 100-position
} else if (jumpSpaces > 3)
{jumpSpaces *= .75}
else
{jumpSpaces--}
if (position != msg.length) {
var cmd = "snapIn(" + jumpSpaces + "," + position + ")";
scrollID = window.setTimeout(cmd,scroll.delay);
} else {
window.status=""
jumpSpaces=0
position=0
cmd = "snapIn(" + jumpSpaces + "," + position + ")";
scrollID = window.setTimeout(cmd,scroll.delay);
return false
}
return true
}
snapIn(100,0);
// -->
</script>
    

  暂时为大家提供这么多,希望大家喜欢! 

0

评论Comments