Entry
How do I get the name of the variable within the object?
Dec 30th, 2002 12:16
Zoltan Budai, Mark Filipak,
This question has already been answered. See this question:
How do I expose the properties of an object?
You will find your answer there. -- Mark Filipak
Not really..
Here is an example to make it clear:
function ThisIsATest {
this.something=3
this.hello=test_hello
this.test=test_test
}
function test_hello {
alert("The value is: "+this.something)
}
function test_test {
// ??
}
var o=new ThisIsATest();
Now, is there a way to get the name of the
variable (in this case "o") from within the object?
So that it would be possible to write in test_test:
document.write("o.hello()")
Without knowing the name of the variable with
which the object was created...