Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

FAQ Topic - How do I access a property of an object using a string?

FAQ Topic - How do I access a property of an object using
a string?

There are two ways to access properties: the dot notation and
the square bracket notation. What you are looking for is the square
bracket notation in which the dot, and the identifier to its right,
are replaced with a set of square brackets containing a string. The
value of the string matches the identifier. For example:-

 //dot notation
 var bodyElement = document.body;

 //square bracket notation, using an expression
 var bodyElement = document["bo"+"dy"];


 Postings such as this are automatically sent once a day.  Their
 goal is to answer repeated questions, and to offer the content to
 the community for continuous evaluation/improvement.  The complete
 comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
 The FAQ workers are a group of volunteers.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc