<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
var message = "欢迎光临";
var delay = 5;//变化速度 值越大越快
var space_num = 50; //所占长度
function fly_in(num, now_position){
var msg = message;
var out = "";
for (var i=0; i<now_position; i++){
out += msg.charAt(i);
}
for (var i; i<num; i++){
out += " ";
}
out += msg.charAt(now_position);
window.status = out;
if(num <= 1){
now_position++;
if(msg.charAt(now_position) == ' '){
now_position++;
}
num = space_num-now_position;
}
else{
num--;
}
if(now_position != msg.length){
var cmd = "fly_in(" + num + "," + now_position + ")";
window.setTimeout(cmd,delay);
}
else{
window.status="欢迎光临";
num = 0;
now_position = 0;
cmd = "fly_in(" +num + "," + now_position + ")";
window.setTimeout(cmd,1000);
}
}
var initial_num = space_num;
fly_in(initial_num,0);
</script>
</head>
<body>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
var message = "欢迎光临";
var delay = 5;//变化速度 值越大越快
var space_num = 50; //所占长度
function fly_in(num, now_position){
var msg = message;
var out = "";
for (var i=0; i<now_position; i++){
out += msg.charAt(i);
}
for (var i; i<num; i++){
out += " ";
}
out += msg.charAt(now_position);
window.status = out;
if(num <= 1){
now_position++;
if(msg.charAt(now_position) == ' '){
now_position++;
}
num = space_num-now_position;
}
else{
num--;
}
if(now_position != msg.length){
var cmd = "fly_in(" + num + "," + now_position + ")";
window.setTimeout(cmd,delay);
}
else{
window.status="欢迎光临";
num = 0;
now_position = 0;
cmd = "fly_in(" +num + "," + now_position + ")";
window.setTimeout(cmd,1000);
}
}
var initial_num = space_num;
fly_in(initial_num,0);
</script>
</head>
<body>
</body>
</html>