Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Statements
STATEMENT: with
with
The
with
statement establishes a default object for a set of statements. If there are any unqualified names in a set of statements, JavaScript first checks the default object to see if they exist there as properties of that object; otherwise a local or global variable is used.
In the following example the default object is 'beer' and the code displays one of two messages depending on the value of the property 'percent_proof':
Code:
with(beer)
{
if(percent_proof < 5)
document.write("Call this a strong beer?!");
else
document.write("This is what I call a beer!");
}
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information