JS实现动态字幕
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TESTJS</title>
<script type="text/javascript">
var message = "欢迎某某莅临我校视察";
message += "莫某单位";
var space = "...";
var position = 0;
function scroller(){
var newtext = message.substring(position,message.length)
+space+ message.substring(0,position);
var td = document.getElementById("tabledata");
td.firstChild.nodeValue = newtext;
position ++;
if( position > message.length){
position = 0;
}
window.setTimeout(scroller,200);
}
</script>
</head>
<body bgcolor="#006400" onload="scroller();">
<table border="1">
<tr>
<td id="tabledata" bgcolor="white">message goes here</td>
</tr>
</table>
</body>
</html>