Javascript Reference
Categories: Operators

javascript Operators with

@March 15, 2008, 1:22 a.m.
with Firefox/Netscape/NN 2 IE 3 ECMA 1  


The with statement adds an object to the scope of every statement nested within. This can shorten the code of some statement groups that rely on a particular object reference. Note that with constructions are generally very inefficient. You can achieve better performance by assigning the object reference to a local variable, and using that variable in your function.

with (document.forms[0]) {
    name1 = firstName.value;
    name2 = lastName.value;
    mail = eMail.value;

Powered by Linode.