well you'll need to capture the dimensions of the window
then you'll need to generate random numbers <= the height and width of the screen (minus the width/height of the box)
give the box an absolute position, and give the box have the generated x,y coordinates
then set a timer to call this function again.
:)
$(document).ready(function() { randoBox = { width:$("body").width(), height:$("body").height(), x:0, y:0, el:null, time:1000, state:"active", init: function(){ el = $(document.createElement('div')); el.attr("style","position:absolute;left:"+this.x+";top:"+this.y+";"); el.html("DVD") el.height(100); el.width(100); $("body").append(el); }, move:function(){ this.y = Math.random()*this.height+1; this.x = Math.random()*this.width+1; el.attr("style","position:absolute;left:"+this.x+";top:"+this.y+";"); }, run:function(state){ if (this.state == "active" || state){ this.move(); setTimeout(function(){this.run()},this.time); } } } randoBox.init(); randoBox.run(true); });