taking it a little further:

<script language="javascript">
 function cfadumpswitch(source) {
  target = source.parentElement.cells[1].style;
  if (target.display == 'none') {
   source.style.fontStyle = 'normal';
   source.style.backgroundColor = 'aaaaee';
   target.display = '';
  } else {
   source.style.fontStyle = 'italic';
   source.style.backgroundColor = 'silver';
   target.display = 'none';
  }
 }


 function inspect(obj)
 {
  document.write('<table border="1" cellspacing="0" cellpadding="1"
bgcolor="#aaaaee" bordercolor="Blue">');
    for (p in obj)
    {
     document.write('<tr>');
     document.write('<td valign="top" onClick="cfadumpswitch(this)"
>'+p+'</td>');
     document.write('<td valign="top" bgcolor="#ffffff" >');
       if(typeof(obj[p])=='object')
     {
       document.write('<table border="1" cellspacing="0" cellpadding="1"
bgcolor="#aaaaee" bordercolor="Blue">');
    inspect2(obj[p]) ;
    document.write('</table>');
    document.write('</td>');
    document.write('</tr>');
     }
     else
     {
    document.write(eval('obj.'+p)+'<br>');
    document.write('</td>');
    document.write('</tr>');
     }
    }
   document.write('</table>');
 }

 inspect(location);
</script>


"Scott Barnes" <[EMAIL PROTECTED]> wrote in message news:22278@cfaussie...
>
> Ever had the need for a CFDUMP but in Javascript? If so, use this :)
>
>  function inspect(obj) {
>   var str = "<font face='arial' size='-2'>";
>   for (var prop in obj)
>    str += "obj." + prop + " = " + obj[prop] + "<br>"
>   top.debugWindow.document.writeln(str);
>  }
>
> pass the Object into this function and it will return a dump of that
object.
> I have a blank debug iFrame in all my apps that i just write debug
> information (ie much like Actionscripts Output window)
>
> Scott.
>
>
>
> --
> Freelance Application Developer / Designer
> --
> ph: 07 3288 6702
> mob: 04040 32812
> --
> url: http://www.spidaweb.com
>
>
>
>
>



---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to