Originariamente inviato da cassano
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Pagina senza titolo</title>
<script language="javascript" type="text/javascript">
<!--

function window_onresize() 
{
    var cs = ClientSize();
    var w = cs.width;
    var h = cs.height;

    document.body.style.backgroundImage = "url(http://localhost/ArchivioEsempi2/Cor...a1.gif&height=" + h  + "&width=" + w + ")";

}

function ClientSize() 
{
    var myWidth = 0, myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) 
    {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } 
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
    {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } 
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
    {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    return {width:myWidth, height:myHeight };
}
function window_onload() 
{
    window_onresize();
}

// -->
</script>
    
</head>
<body onresize="return window_onresize()" style="background-repeat:no-repeat" onload="return window_onload()">
</body>
</html>
naturalmente, la pagina img.aspx ridimensiona l'immagine a seconda dei parametri altezza e larghezza passati. Con IE e Firefox funziona bene, con Opera, come Totti, al 75.8%