alert(document.title);
alert(document.body.tagName);
alert(document.location);
Here is the with Statement:
with (document) {
alert(title);
alert(body.tagname);
alert(location);
}
"It is another scope. When you use the with statement, you are forcing the interpreter to not only look up the scope tree for local variables, but you are also forcing it to test each variable against the object specified to see if it's a property" - "Professional Javascript for Web Developers, Nicholas C Zakas, p 581
No comments:
Post a Comment