/* make a word bounce across the page */
var word = document.createElement('div');
word.innerHTML = 'Hello World';
word.style.position = 'absolute';
word.style.left = '0px';
word.style.top = '0px';
document.body.appendChild(word);
var left = 0;
var top = 0;
var direction = 1;
var speed = 1;
function moveWord() {
left += direction * speed;
word.style.left = left + 'px';
if (left > window.innerWidth - word.clientWidth) {
direction = -1;
} else if (left < 0) {
direction = 1;
}
setTimeout(moveWord, 10);
}
moveWord();