<!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>