For example:
var a = document.getElementById("divVar");
a.style.font="bold 13px verdana";
a.style.color="#F00";
...
with(document.getElementById("divWith")){
style.font="bold 14px Georgia";
style.color="#00F";
...
}
Which one do you think is better?
with()is considered harmful by Mr Crockford.The reason? It is very easy to clobber existing variables, if the property you think exists doesn’t, for example.
From the article…
The compromise is your first example.