- <!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>123456789</title>
- <!-- <script type="text/javascript">
- function scroll(){
- var title=document.title;
- var firstCh=title.charAt(0);
- var leftStr=title.substring(1,title.length);
- document.title=leftStr+firstCh;
- }
- setInterval("scroll()",500)
- </script>-->
- <script type="text/javascript">
- // 有问题 在运行时点击切换时出现问题!!!切换后依旧滚动但不是按预期的滚动
- var m;
- var n;
- function left(){
- var title=document.title;
- var firstCh=title.charAt(0);
- var leftStr=title.substring(1,title.length);
- document.title=leftStr+firstCh;
- }
- function right(){
- var title=document.title;
- var rightCh=title.charAt(title.length-1);
- var leftStr=title.substring(0,title.length-1);
- document.title=rightCh+leftStr;
- }
- function leftScroll(){
- clearInterval(n);
- var m=setInterval("left()",500);
- }
- function rightScroll(){
- clearInterval(m);
- var n= setInterval("right()",500);
- }
-
- </script>
- </head>
- <body>
- <input type="button" value="向左滚动" onclick="leftScroll()" />
- <input type="button" value="向右滚动" onclick="rightScroll()" />
- </body>
- </html>
复制代码 |