Ciao ho questa funzione:
con la quale ottengo la dimensione di una pagina html.codice:<script type="text/javascript"> function alertSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) { myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } window.alert( 'Width = ' + myWidth + ' and height = ' + myHeight ); } </script>
Come posso far si che i valori myWidht e maHight finiscano negli atributi per impostare altezza e larghezza della pagina?

Rispondi quotando