Prev: WebSign: A live demonstration to sign your signature on HTML pages, and save it to database
Next: WebSign: A live demonstration to sign your signature on HTML pages, and save it to database
From: FAQ server on 3 Feb 2010 19:00 ----------------------------------------------------------------------- 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"]; http://jibbering.com/faq/faq_notes/square_brackets.html The complete comp.lang.javascript FAQ is at http://jibbering.com/faq/ -- The sendings of these daily posts are proficiently hosted by http://www.pair.com.
From: Dr J R Stockton on 28 Feb 2010 18:09
In comp.lang.javascript message <4b6a0e09$0$275$14726298(a)news.sunsite.dk >, Thu, 4 Feb 2010 00:00:03, FAQ server <javascript(a)dotinternet.be> posted: > > >//square bracket notation, using an expression >var bodyElement = document["bo"+"dy"]; That should be replaced by something that looks useful, similar to var formNumberJ = document.forms["Frm" + J] -- (c) John Stockton, nr London UK. ??@merlyn.demon.co.uk Turnpike v6.05 MIME. Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links. In MS OE, choose Tools, Options, Send; select Plain Text for News and E-mail. Don't quote more than is needed, and respond after each quoted part. |