代码如下:
ABCDEFGHIJKLvar direction = 'left';
onload = function () {
setInterval(function () {
var titleText, firstChar, others;
titleText = document.title;
if (direction = 'left') {
firstChar = titleText.charAt(0);
others = titleText.substring(1);
document.title = others + firstChar;
} else {
firstChar = titleText.charAt(title.length - 1);
others = titleText.substring(0, title.length - 1);
document.title = firstChar + others;
}
}, 200);
document.getElementById('btnr').onclick = function () {
direction = 'right';
};
document.getElementById('btnl').onclick = function(){
direction = 'left';
};
};