La fretta, come mi fa notare Carlo (grazie) manca il document.getElementById fai cosi:
codice:<html> <head> <script> window.onload=setup; var height=200; var width=height; function setup () { setTimeout(function () {ingrandisci('quadrato')},1000); document.getElementById('quadrato').setAttribute("height",height+"px"); document.getElementById('quadrato').setAttribute("width",width+"px"); } function ingrandisci (div) { if (height <= 500) { height+=40; width=height; document.getElementById(div).setAttribute("height",height+"px"); document.getElementById(div).setAttribute("width",width+"px"); setTimeout(function () {ingrandisci(div);},200); } } </script> </head> <body> <div id="quadrato" style="height:200px;width:200px;background-color:blue;" ></div> </body> </hmtl>![]()

Rispondi quotando