Geeks With Blogs

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

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):

).value = text;
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";

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";


Posted on Friday, July 11, 2008 10:52 AM ASP.NET , PHP (incl PhpMyAdmin) | Back to top

Comments on this post: Web development client side debugging - display area, javascript injection and accessing the dom at runtime

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Tim Huffam | Powered by: