第一篇博客

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Document</title>

<script type="text/javascript">

//设置滚动内容

var word=new Array();

word[1]="欢迎学习JavaScript网页特效"

word[2]="http://dynamicdrive.com"

word[3]="这是你我的网页特效家园"

word[4]="欢迎你给我们提出宝贵的意见!"

word[5]="欢迎你加入网站建设队伍!"

//设置字体大小

var word_fontsize="16px";

var longestmessage=1;

for(i=2;i<word.length;i++){

if(word[i].length>word[longestmessage].length){

longestmessage=i;

}

}

//自动设置scroll长度

var scroller_width=word[longestmessage].length;

lines=word.length-1;

if(document.all||document.getElementById){

document.write('<form name="bannerform">');

document.write('<input type="text" name="banner" size="+scroller_wdith+5+"')

document.write('style="background-color:'+document.bgColor+';color:'+document.body.text+';font-size:'+word_fontsize+';borde:medium none"οnfοcus="blur()">');

document.write('</form>');

 

}

temp="";

nextchar=-1;

nextline=1;

cursor="\\";

function animate(){

if(temp==word[nextline]&temp.length==word[nextline].length&nextline!=lines){

nextline++;

nextchar=-1;

document.bannerform.banner.value=temp;

temp="";

setTimeout("nextstep()",3000)

}

else if (nextline==lines&temp==word[nextline]&temp.length==word[nextline].length){

nextline=1;

nextchar=-1;

document.bannerform.banner.value=temp;

temp="";

setTimeout("nextstep()",3000);

}

else{nextstep()};

}

function nextstep(){

if(cursor=="\\"){

cursor="|";

}

else if(cursor=="|"){

cursor="/"

}

else if(cursor=="/"){

cursor="-"

}

else if(cursor=="-"){

cursor="\\"

}

nextchar++;

temp+=word[nextline].charAt(nextchar);

document.bannerform.banner.value=temp+cursor;

setTimeout("animate()",100)

}

if(document.all||document.getElementById)

window.οnlοad=animate

</script>

</head>

<body>

</body>

</html>

转载于:https://my.oschina.net/LjioaccH/blog/2249010

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值