[thelist] Javascript: Objects to Strings
Isotope2k@aol.com
Isotope2k at aol.com
Mon, 29 Nov 1999 14:24:50 EST
In a message dated 11/29/99 12:58:53 PM US Eastern Standard Time,
MinhLee_Goon@sdstate.edu writes:
<< I'd like to convert an object to string in my script. >>
I'm not sure what you are looking for here. My first
inclination is to bring up the "toString" method
which all built-in javascript objects have... Well,
technically all Objects (note capital O) inherit the toString method
(http://devedge.netscape.com/docs/manuals/js/client/jsref/object.htm#1193350)
but most of them override it, and instead do something
useful with the toString method. The default toString method
returns something like "[object Image]" or an object literal
if you specified javascript1.2.
The eval() function doesn't actually turn string into objects.
It can concatenate a string and return an object reference.
That's more a semantic difference, but still worth pointing
out.
I haven't answered your question. Let me pose a
poignant one- How did you refer to the object if
you don't know the "string" which represents it?
If you could maybe give a broader idea of what
you are doing, it might help.
Christopher Atkins