Ho questa funzione che mi legge le dimensioni della pagina sia in altezza che in larghezza:
Come faccio a far diventare myWidth e myHeight valori per precisare l'altezza e la larghezza della pagina nel tag body?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>

Rispondi quotando