nice, you should turn that into a Favelet if you haven't already.

Duncan Cumming
IT Manager

http://www.alienationdesign.co.uk
mailto:[EMAIL PROTECTED]
Tel: 0141 575 9700
Fax: 0141 575 9600

Creative solutions in a technical world

----------------------------------------------------------------------
Get your domain names online from:
http://www.alienationdomains.co.uk
Reseller options available!
----------------------------------------------------------------------
----------------------------------------------------------------------


                                                                                       
                            
                    "Alex                                                              
                            
                    Skinner"             To:     <[EMAIL PROTECTED]>                   
                  
                    <[EMAIL PROTECTED]        cc:                                      
                                 
                    o.uk>                Subject:     RE: [ cf-dev ] Javascript object 
inspector                   
                                                                                       
                            
                    29/10/2003                                                         
                            
                    17:30                                                              
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    dev                                                                
                            
                                                                                       
                            
                                                                                       
                            



I use this if it helps anyone

Alex

function ListObj (obj, str) { // dump objects and contents
var s = new Array ();
var i;
var j = 0;
  for (i in obj) {   // get all objects, and contents
    s[j] = i + ": " + obj[i];
    j = j + 1;
  }
  s.sort ();         // sort them data down
  var win = window.open("");
  var doc = win.document;
  doc.open ("text/html");  // open a new document
  doc.writeln ("<html><head>",
                    "<title>Dump page</title>",
                    "</head><body>",
                    "<p><b>",
                    str, " contents.<br />",
                    navigator.appName, "<br />",
                    navigator.userAgent, "</b><br /><br />");
  for (i=0; i<j; i++) {
    doc.writeln (s[i], "<br />");
  }
  doc.writeln ("</p></body></html>");
  doc.close ();  // close down output stream
}





-----Original Message-----
From: Paul Johnston [mailto:[EMAIL PROTECTED]
Sent: 29 October 2003 17:29
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] Javascript object inspector


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]





--
** 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]

Reply via email to