psc_stats: There was an error while add allocation for measure with ID '2342' and topic with ID '2'.Duplicate entry '2342-2' for key 'PRIMARY'
psc_stats: There was an error while add allocation for measure with ID '2342' and topic with ID '3'.Duplicate entry '2342-3' for key 'PRIMARY'

Aktion “Stoppt die Vorratsdatenspeicherung”

Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:
Thursday, 14. June 2007 - 21:32

JavaScript: get_class

Dieser Beitrag ist auch in deutsch verfügbar (empfohlen).


/**
 * Returns the name of the class of an object
 *
 * NOTE: This function doesn't work with 'native code', only with user generated classes.
 *
 * based on http://magnetiq.com/2006/07/10/finding-out-class-names-of-javascript-objects/
 *
 * @param object The object
 * @returns mixed Returns the name of the class of which object is an instance. Returns FALSE if object is not an object.
 */
function get_class(obj)
{
	if(obj && obj.constructor && obj.constructor.toString)
	{
		var arr = obj.constructor.toString().match(/function\s*(\w+)/);
		return (arr && (arr.length==2?arr[1]:undefined));
	}
	else
	{
		return undefined;
	}
}
Filed under: Webdev
Technorati Tags:

Embassies

There are no comments.


Comment entry

Personal informations

Spam protection:

Trackback(s)

What's trackback?

A trackback is a kind of a source link. If i was finding an interesting entry in another blog, that i am commenting in my own blog, i am linking to the original message via the trackback. Has someone commented one of my entries in his/her weblog, you can find this link here under trackbacks, too. More informations about trackback are in the Wikipedia for example.

Trackback URL: http://geeks-have-feelings-too.net/trackback/javascript-getclass/

There are no trackbacks for this entry.

Sidebar

Recent acoustic enchantment

Clare Burson - Love Me In The Morning

Random Thought

Born to run Unix.

Change the emotion

Firefox Add to Technorati Favorites