FW: [Javascript] strings into variables

Filipiak, Bob (Contractor) filipiab at atsc.army.mil
Wed Aug 1 10:50:43 CDT 2001


ÿþ<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD> <META http-equiv=Content-Type content="text/html;
charset=unicode"> <META content="MSHTML 6.00.2462.0" name=GENERATOR></HEAD>
<BODY> <DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=770504915-01082001>This is to test characterset. Sorry for the
repost.</SPAN></FONT></DIV> <DIV>&nbsp;</DIV> <P><FONT size=2>Bob Filipiak
(Contractor)<BR>MCP </FONT></P> <DIV class=OutlookMessageHeader dir=ltr
align=left><FONT face=Tahoma size=2>-----Original
Message-----<BR><B>From:</B> Peter Brunone
[mailto:peter at brunone.com]<BR><B>Sent:</B> Wednesday, August 01, 2001 11:41
AM<BR><B>To:</B> javascript at LaTech.edu<BR><B>Subject:</B> Re: [Javascript]
strings into variables<BR><BR></FONT></DIV> 
David,
 
    Read up on the eval() function.  It can take a string and turn it into
the appropriate object reference, e.g.
 
var myPointer = eval("document.all.myDiv.style.color");
 
    Should be what you're looking for.
 
Cheers,
 
Peter

----- Original Message ----- 
From: David  <mailto:dlevy at lancer-ins.com> Levy 
To: javascript at LaTech.edu <mailto:javascript at LaTech.edu>  
Sent: Wednesday, August 01, 2001 10:02 AM
Subject: [Javascript] strings into variables

Hi, I'm trying to turn a string into a variable name.  In other words,
suppose I get input from a user, and want to convert that string into a name
of a variable and use it in a function.  The reason I have for doing this is
that the input I get from the user will be an actual preexisting variable
name in the script, but there are very many of these variables and I'd like
to refer to them without using switches.  I hope this was clear and please
tell me if you need clarification.
 
David Levy.
 

</BODY></HTML> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010801/72840f23/attachment.htm>


More information about the Javascript mailing list