JavaScript小功能跑马灯【每日一段代码2】
<html>
<head>
<title>跑马灯</title>
<style type="text/css">
body{
background-color:#06F;
}
input{
background:transparent;
border:none;
color:#FFF;
font-size:35px;
font-weight:bold;
font-family:微软雅黑;
}
</style>
<script type="text/javascript">
var msg="跑马灯文字,吽哈哈。";
var interval = 550;
var seq=0;
function LenScroll() {
document.nextForm.lenText.value = msg.substring(seq, msg.length)+" "+msg;
seq++;
if(seq>msg.length)
seq = 0;
window.setTimeout("LenScroll();",interval);
}
</script>
</head>
<body onload="LenScroll()">
<center>
<form name="nextForm">
<input type="text" name="lenText" />
</form>
</center>
</body>
</html>
【简单的JavaScript代码,实现的跑马灯小功能。如果你是程序小白可以来看一下,练练手还是可以的。谢绝大牛围观。】
html5