RSS Forums RSS
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 340 | Replies: 0
Reply
Join Date: May 2008
Posts: 2
Reputation: alexhernandez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
alexhernandez alexhernandez is offline Offline
Newbie Poster

Discovering variables in javascript

  #1  
May 16th, 2008
Hi all,

I'm just wondering..... Is there any way to know what variables are associated to a given kind of data type or class (when using prototype for example)?

Let me explain.

if I have:

// javascript:

var myVar = new Array();
var myObj = new CustomPrototypeClass();

So, in some way I want to do something like:


alert(myVar.variableName())

that shows:

myVar

or

alert(myObj.variableName);

will show

myObj


what I need to do is reference a variable inside another code depending on the type of object I'm manipulating. I'm getting that effect including the name of the variable as a parameter to my custom class, like:

var myObj = new CustomObject(param1, param2, "myObj");

But it looks too freaking weird!!!!!!

Is there any other elegant way to achieve what I want? any Ideas? I think I'm good at JS but I can't figure it out.

thanks in advance.

Alex
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:59 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC