Blogger Information
Blog 250
fans 3
comment 0
visits 321522
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
JS-文字跑马灯特效
梁凯达的博客
Original
3500 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<font id="show" color="blue" size="6"></font>
</body>
<script>
var show = document.getElementById('show');
var str = '今天也是3月1号也就是说一九年已经过去两个月了';
//将字符串添加标签的函数
function pick(i,str){
	tmp = str.substr(0,i);
	tmp +='<font color="red" size="7">'+str[i]+'</font>';
	tmp += str.substr(i+1);
	//alert(tmp);
	return tmp;
}
	var num = 0;
	setInterval(function(){
		if(num >=str.length){
			num = 0;
		}
		show.innerHTML =pick(num,str);
		num++;
	},300)
</script>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post