<script> var timer=null; window.onload=function(){ timer=setInterval("resize()",50); } function resize(){ var div=document.getElementsByTagName("div")[0]; var w=parseInt(div.style.width); var h=parseInt(div.style.height); var t=parseInt(div.style.top);
var timer=null;
window.onload=function(){
timer=setInterval("resize()",50);
}
function resize(){
var div=document.getElementsByTagName("div")[0];
var w=parseInt(div.style.width);
var h=parseInt(div.style.height);
var t=parseInt(div.style.top);
if(w==1 || h==1)clearInterval(timer);
div.style.width = w-1;
div.style.height = h-1;
div.style.top = t+1;
}
</script>
<div style="position:absolute;width:100px;height:100px;left:100px;top:100px;background:#eee;"></div>