如何将标题标签中的滚动文字? [英] How to put scrolling text in title tag?
本文介绍了如何将标题标签中的滚动文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让标题的文字可滚动,我将代码放在滚动条的下方,但我输入的文本没有空格显示,这意味着不考虑字符串中的空格。
I want to make text of title scrollable, I make the code as under it scrolls fine but the text I entered is displayed without space, meaning space in string is not considered.
<script type="text/javascript">
//function for tittle scrolling
function scrlsts() {
//var scrltest = " Nature ";
scrltest=document.title;
//alert(scrltest);
scrltest = scrltest.substring(1, scrltest.length) + scrltest.substring(0, 1);
//alert(scrltest);
document.title = scrltest;
setTimeout("scrlsts()", 1000);
}
$(document).ready(function() {
var scrltest = " Nature dff ssfd ";
document.title=scrltest;
scrlsts();
});
</script>
预先致谢
Thanks in advance
推荐答案
长时间没做这些,但这应该工作:
(function titleScroller(text) {
document.title = text;
setTimeout(function () {
titleScroller(text.substr(1) + text.substr(0, 1));
}, 500);
}(" Nature dff ssfd "));
这篇关于如何将标题标签中的滚动文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文