Tim Huffam

Dotting the I and crossing the T of I.T.

  Home  |   Contact  |   Syndication    |   Login
  129 Posts | 0 Stories | 874 Comments | 677 Trackbacks

News

Archives

Post Categories

Interesting Blogs/Links

For those of you who don't have access to IE or FF dev toolbars - this is how we used to do client side runtime debugging...

Drop the following code into your web page (preferrably at the bottom):

<script>
function
log(text){
  document.getElementById("logArea"
).value = text;
}
function
dump(){
  log(document.body.innerHTML);
}
function logProps(obj){
 
var msg = "";
  for(var i=0;i<obj.attributes.length;i++)
  {
    msg+=obj.attributes[i].nodeName + ": " + obj.attributes[i].nodeValue + "\r\n";
  }
  log(msg);
}

</script>
<
input ondblclick="eval(this.value)" /><br
/>
<
textarea id="logArea" cols="80" rows="20"></textarea>

This should be self explanatory - the html controls provide a place to enter and run javascript (eg to query the DOM at runtime) and somewhere to dump the data.  And the javascript provides some helper functions - for dumping data and for querying all the properties of an object.

The following is a IE specific version of the for loop which may show a few other properties:
  for(x in obj)
  {
    msg+=x + ": " + obj[x] + "\r\n";
  }

HTH
Tim

posted on Friday, July 11, 2008 10:52 AM