标题: 向左滚实现了,向右滚有点问题。 [打印本页] 作者: 黄珍 时间: 2012-4-11 12:24 标题: 向左滚实现了,向右滚有点问题。 <head>
<title>神龙汽车有限公司欢迎您送死</title>
<script type = "text/javascript" >
function scrollleft() {
var title = document.title;
var firstchar = title.charAt(0);
var leftstr = title.substring(1, title.length);
document.title= leftstr+firstchar; }
scrollleft();
setInterval("scrollleft()", 300);
这是标题向左滚的效果,下面是向右滚的,不知哪里有问题?
function scrollright() {
var title = document.title;
var firstchar = title.charAt(title.length);
var rightstr = title.substring(0,title.length -1);
document.title = rightstr +firstchar;
}
setInterval("scrollright()", 300);
</script>
</head> 作者: 非常小可 时间: 2012-4-12 19:48
function scrollright() {
var title = document.title;
var firstchar = title.charAt(title.length);
var rightstr = title.substring(title.length -1,0);
document.title = rightstr +firstchar;
}
setInterval("scrollright()", 300);
</script>
这样试下行不作者: 胡振超 时间: 2012-4-12 21:27
修改两个地方,已用粗体标出
<script type = "text/javascript" >
function scrollright() {
var title = document.title;
var firstchar = title.charAt(title.length-1);
var rightstr = title.substring(0,title.length -1);
document.title = firstchar+rightstr;
}
setInterval("scrollright()", 300);