No le estás agregando la unidad de medida. Así funciona:
  Código PHP:
    <!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
 
</head>
 
<body>
<div id="fondo"></div>
<script language=javascript> 
function ini()    { 
    var elFondo = document.getElementById("fondo").style 
    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
 
        }
//hasta aqui bien para FF
 
    elFondo.width = myWidth +'px'; 
    elFondo.height= myHeight+'px';
    alert( elFondo.width)
}
ini();
</script>
</body>
</html>