循环滚动


<html>
	<head>
		<meta charset="UTF-8">
		<title>title>
		<style>
			#s1{
				display: inline-block;
				border: 1px solid black;
				padding: 2px;
			}
		style>
		<script>
			var msg = new Array();
			msg[0]="嗨!您好。看见了吗?"
			msg[1]="您可根据自己的需要显示不同的内容!";
			msg[2]="可在这个窗口内显示最新信息!"
			
			var n = 0;
			var i = 0;


			function move(){
				var s1 = document.getElementById("s1");
				var s = s1.innerText;
				s = s.substr(1) + s.substr(0,1);
				s1.innerText = s;
				n++;
				if(n >= msg[i].length){
					if(i == 2){
						i = 0;
					}else{
						i++;
					}
					s1.innerText = msg[i];
					n = 0;
					setTimeout("move()",1000);
				}else{
					setTimeout("move()",1000);
				}
				
			}
			
		script>
	head>
	<body onload="move()">
		<span id="s1">嗨!您好。看见了吗?span>
	body>
html>
--------------------- 
作者:王琦wq 
来源:CSDN 
原文:https://blog.csdn.net/weixin_39003621/article/details/86496730 
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(代码,HTML)