Saturday, May 19, 2012 Forums RegisterLogin
Users Online
Membership Membership:
Latest New User Latest: codemonkeymike
Past 24 Hours Past 24 Hours: 0
Prev. 24 Hours Prev. 24 Hours: 0
User Count Overall: 19

People Online People Online:
Visitors Visitors: 40
Members Members: 0
Total Total: 40

Online Now Online Now:
    

SacDeveloper Forums

These forums are here for you to ask questions or even to answer a few.
Please keep the content relevant and civil.
Report any posting abuses.
SacDeveloper Forums
HomeHomeProgrammingProgrammingJavascriptJavascriptDebuging functionsDebuging functions
Previous
 
Next
New Post
11/3/2008 10:55 AM
 
Debuging functions  (United States) Modified By Ryan Mick  on 11/3/2008 2:04:56 PM

Here are a couple of helpful debuging function for javascript. The first function will display a popup with properties of the passed in object "o" in 20 element increments. The second function displays the properties of the passed in object "o" in a new window. To use these functions is very easy, just pass it a reference to an object. If you are doing a lot of DHTML of client side validation these functions can save you quite a headache. Please let me know if you have any questions.

// This function will show all properties for the object passed in...
function displayObjProperties(o) {
 var result = "";
    count = 0;
    for (var i in o) {
        result += o + "." + i + "=" + o[i] + "\n";
        count++;
        if (count == 20) {
             result);
            result = "";
            count = 0;
        }
    }
     result);
}
function displayObjPropertiesInWindow(o){
    var result = "";
    count = 0;
    for (var i in o) {
        result += o + "." + i + "=" + o[i] + "\n";        
    }
    var win = window.open();
    win.document.write("<CODE>" + result + "</CODE>");    
}
 
Previous
 
Next
HomeHomeProgrammingProgrammingJavascriptJavascriptDebuging functionsDebuging functions


      
Copyright 2008 by Ryan Mick Terms Of UsePrivacy Statement
Downloaded from DNNSkins.com