Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: JavaScript
Expertise: Intermediate
Jun 8, 2009

Error Using JavaScript's this Keyword

Even though this is a reserved word in JavaScript, the following code fails...

with(parent){...this.window.event...} 

...because it can't back out of parent.

The workaround is to assign the window object to a variable first:

o=window; 
with(parent){...o.event...}

That works, although it's clumsy.

Author's Note: This was fail-tested on the Microsoft Internet Explorer versions 6 and 7 popup object.
Raymond Kenneth
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap