questo
var larghezza=document.getElementById("editor").width;
funziona finche' hai nel markup
<table width="640" ...>

questo
var larghezza=document.getElementById("editor").style. width;
funziona finche' hai nel markup (quindi rigorosamente nello stile in linea)
<table style="width:640px" ...>

altrimenti
var larghezza=document.getElementById("editor").offset Width;
supportato ampiamente dai browser moderni, puo' dare incongruenze in presenza di border/padding

ciao