Es curioso...
Mira esto:
Código PHP:
<html>
<head>
<title>Untitled</title>
<STYLE>
#layer1{
POSITION:absolute;
TOP:0px; LEFT:0px;
BACKGROUND-COLOR:green;
BORDER-WIDTH:1px;
BORDER-COLOR:black;
width:100px;
height:10px;
z-index=1;
color:red
}
</style>
<script>
function pepe(){
document.getElementById("layer1").style.width="0px";
alert(document.getElementById("layer1").style.width);
}
</script>
</head>
<body onload="pepe()">
<div id="layer1"></div>
</body>
</html>