<body onload="abd()"> <form id="form1" runat="server"> <div> <label id="lable1">唐玄奘,孙悟空,猪刚烈,沙和尚 </label> </div> </form> </body>
<script type="text/javascript"> function abd() { var a = lable1.innerHTML; a = a.substr(1, a.length - 1) + a.substr(0, 1); lable1.innerHTML = a; var b = setTimeout("abd()", 500); } </script>
<head> <title></title> <script type="text/javascript"> //定义要显示的文字,注意最好是在文字的前后都加上空格,显示时比较美观 var str=" 这个东西真不好做啊!!! "; //一个函数,循环调用 function check(){ //取出要显示文字的第一个字符然后拼接到字符串的末尾 str=str.substr(1)+str.substr(0,1); //把拼接好的字符串显示到状态栏 window.status=str; //把拼接好的字符串显示到标题栏 document.title=str; //每隔半秒调用一次,可以更改数字使它更快或更慢 setTimeout("check()",500); } check(); </script> </head>
<!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> <title>>>>欢迎你能够来学习>>> >>>JavaScript是一门脚本语言>>> </title> </head> <body> <div id="wenzi"> </div> <script type="text/javascript"> var meninfo = " 欢迎你能够来学习 JavaScript是一门脚本语言"; var info = "欢迎你能够来学习 JavaScript是一门脚本语言"; function setSatatus() { document.title = info.substring(0, info.length); //设置title info = info + info.substring(0, 1); info = info.substring(1, info.length); } setInterval(setSatatus, 500); function left() { var id = document.getElementById("wenzi"); if (typeof id.textContent == "string") { id.textContent = meninfo.substring(0, meninfo.length); } else { id.innerText = meninfo.substring(0, meninfo.length); } meninfo = meninfo + meninfo.substring(0, 1); meninfo = meninfo.substring(1, meninfo.length); } setInterval(left, 500) </script> </body> </html>