Estás tratando de acceder a una propiedad no definida, invocando al objeto que la contiene de manera incorrecta. Cuando usás el atributo id, para referirte al objeto tenés que usar document.getElementById. Pero en este caso, como el atributo width nunca fue definido, tampoco te servirá de nada. Probá así:
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=iso-8859-1" />
<title>test</title>
<script>
onload=function(){
var t=document.getElementById('algo');
if(t.offsetWidth>500)
t.width=500;
}
</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" id="algo">
<tr>
<td>Hola, debido a que la instrucción de CSS2 max-width no funciona
en Internet Explorer 7, he optado por buscar por internet alguna solución
para poner el tamaño máximo a una tabla.<br />
<br />
El hecho es que en mi página web tengo unos globos de texto que van variando
según la cantidad de texto que hay, pero no me gustaría que se
expandieran más de 500 píxeles. Para ello he intentado usar un
script que ha fallado.<br /></td>
</tr>
</table>
</body>
</html>