Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #7614
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Get value of named object |
| From | "Evertjan." <exjxw.hannivoort@interxnl.net> |
| References | <a185a7pdddj3ui58j7a8rrtuivpe4gu92l@4ax.com> |
| Message-ID | <Xns9F8687C70E464eejj99@194.109.133.133> (permalink) |
| Date | 2011-10-22 11:20 +0000 |
Swifty wrote on 22 okt 2011 in comp.lang.javascript: > If I have the name of an object in a variable, how would I go about > getting the value of that object? myObject.name perhaps would return the name of an object. > > Example: > varname = 'navigator.appName'; > > How would I get the value of navigator.appName ? > > See http://swiftys.org.uk/jsvars.html for my first, faltering attempt. > > The idea is to replace the multiple "document.write" lines with the > simpler "show()" calls. document.write( "<TR><TH>" + varname + "<TD>" + eval(varname) ); ================= Using eval() indeed is a variable blessing: <H1>JavaScript Varibles</H1> -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar
Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-22 11:56 +0100
Re: Get value of named object "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-10-22 11:20 +0000
Re: Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-22 18:57 +0100
Re: Get value of named object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-22 21:20 +0200
Re: Get value of named object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-22 14:35 +0200
Re: Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-22 18:59 +0100
Re: Get value of named object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-22 21:22 +0200
Re: Get value of named object Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-22 12:53 -0700
Re: Get value of named object Lasse Reichstein Nielsen <lrn.unread@gmail.com> - 2011-10-23 02:10 +0200
Re: Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-23 09:01 +0100
Re: Get value of named object Lasse Reichstein Nielsen <lrn.unread@gmail.com> - 2011-10-23 11:57 +0200
Re: Get value of named object Swifty <steve.j.swift@gmail.com> - 2011-10-24 14:11 +0100
Re: Get value of named object Dr J R Stockton <reply1142@merlyn.demon.co.uk> - 2011-10-23 21:16 +0100
csiph-web