JS小问题,能行马上结贴
<!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>练习123456</title> <script type="text/javascript"> function turnLeft() { var title = document.title; var firstch = title.charAt(0); var secondch = title.substring(1, title.length); var finalch = secondch + firstch; document.title = finalch; } function turnRight() { var title = document.title; var firstch = title.charAt(title.length-1); var secondch = title.substring(0, title.length-1); var finalch = firstch +secondch ; document.title = finalch; } function scrollLeft() { //clearInterval(scrollRight); var scrollLeft1=setInterval("turnLeft()", 500); } function scrollRight() { // clearInterval(scrollLeft); var scrollRight1=setInterval("turnRight()", 500); } </script></head><body > <input type="button" value="标题向左滚动" onclick="scrollLeft()" /> <input type="button" value="标题向右滚动" onclick="scrollRight()"/></body></html>
<!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>练习123456</title> <script type="text/javascript"> function turnLeft() { var title = document.title; var firstch = title.charAt(0); var secondch = title.substring(1); var finalch = secondch+firstch; document.title = finalch; } function turnRight() { var title = document.title; var firstch = title.charAt(title.length-1); var secondch = title.substring(0, title.length-1); var finalch = firstch +secondch ; document.title = finalch; } function scrollLeft2(){ var scrollLeft1=setInterval("turnLeft()", 1000); } function scrollRight() { var scrollRight1=setInterval("turnRight()", 1000); } </script></head><body> <input type="button" value="标题向左滚动" onclick="scrollLeft2()" /> <input type="button" value="标题向右滚动" onclick="scrollRight()"/></body></html>
[解决办法]
呵呵 我也不断调试发现的这个问题