Thanks...
Figured it out very quickly after sending the message...
Hint for everyone else: Don't do this:
Function getProperties(obj) {
content = '';
for(var prop in object) {
content += prop + ': ' + obj[prop] + '\n';
}
alert(content);
}
Because it returns EVERYTHING! Not very useful! Much better to return a
list of the properties imho.
Paul
> -----Original Message-----
> From: Adrian Lynch [mailto:[EMAIL PROTECTED]
> Sent: 29 October 2003 17:05
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ cf-dev ] Javascript object inspector
>
>
> <script>
>
> var obj = new Object();
> obj.name = "adrian";
> obj.age = 25;
>
> for( var i in obj ) {
> alert(i + ": " + obj[i]);
> }
> </script>
>
> Seems to work
>
> Ade
>
> -----Original Message-----
> From: Adrian Lynch [mailto:[EMAIL PROTECTED]
> Sent: 29 October 2003 16:55
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ cf-dev ] Javascript object inspector
>
>
> Is there a for in loop available in JS?
>
> for (i in object) {
> //output properties
> }
>
> -----Original Message-----
> From: Paul Johnston [mailto:[EMAIL PROTECTED]
> Sent: 29 October 2003 16:52
> To: [EMAIL PROTECTED]
> Subject: [ cf-dev ] Javascript object inspector
>
>
> What's the javascript to view the properties of an object? I
> can't remember it offhand.
>
> Ie you get an object in javascript but can't remember what
> objects/whatever it contains. How do you find these?
>
> Paul
> -----------------------------------
> Paul Johnston
> PJ Net Solutions Ltd
> http://www.pjnetsolutions.com
> [EMAIL PROTECTED]
> +44 (0)7866 573013
>
>
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED] For human help, e-mail:
> [EMAIL PROTECTED]
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED] For human help, e-mail:
> [EMAIL PROTECTED]
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED] For human help, e-mail:
> [EMAIL PROTECTED]
>
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]