The with Statement

The with statement is not one that you’ve seen in earlier topics on PHP, because it’s exclusive to JavaScript. With it (if you see what I mean), you can simplify some types of JavaScript statements by reducing many references to an object to just one reference. References to properties and methods within the with block are assumed to apply to that object.
For example, take the code in following Example, in which the document.write function never references the variable string by name.

string = "The quick brown fox jumps over the lazy dog"
with (string)
document.write("The string is " + length + " characters<br />")
document.write("In upper case it's: " + toUpperCase())

You may also like...