"); browser.document.close(); // returns false for event handlers return false; } // recurrsive function to get properties of objects function getProps(obj){ // for loop to run through properties of incoming object for(var prop in obj){ browser.document.writeln("
  • "); // if the property is an object itself, but not null... if(typeof(obj[prop])=="object" && obj[prop]!=null){ // get index of object in objects array valIndex = arrayIndexOf(objects, obj[prop], 0); // if not in index array, add it and create its key if(valIndex==-1){ valIndex = objects.length; key = ((new Date()).getTime()%10000) + "_" + (Math.floor(Math.random()*10000)); objects[valIndex] = new Array(obj[prop], key, false); } // write link for this object to call openDOMBrowser with its key browser.document.writeln(""+prop+ " : "+(new String(obj[prop])).replace(/"); // determine whether object should be expanded/was already expanded if(objects[valIndex][2] && !expanded[objects[valIndex][1]]){ // if it needs to be expanded, add to expanded array expanded[objects[valIndex][1]] = true; // write nested list tag and recurrsive call to getProps browser.document.writeln(""); } } else { // if not an object, just write property, value pair ie5fix = (typeof(obj[prop])=="unknown")?"":(new String(obj[prop])).replace(/"+prop+" : " + ie5fix); } browser.document.writeln("
  • "); } } // function to find object in an array by field value function arrayIndexOf(array, value, field){ var found = false; var index = 0; while(!found && index < array.length){ // field may be object reference or key if(array[index][field]==value) found = true; else index++; } return (found)?index:-1; } // End -->


    Home } Page Details } DOM Browser



    The DOM Browser is a visual, interactive representation of the DOM (Document Object Model). It's helpful to beginners learning to interact with the DOM in JavaScript. It's also a great tool for side-by-side comparisons of Netscape, Internet Explorer, and other browsers and how they interpret the document and its elements.

    The JavaScript Source: Page Details: DOM Browser

    Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!

        

    Did you use this script?  Do you like this site?  Please link to us!

    Add a comment, suggestion, or correction
    [For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

        
       
           
    [optional]
     
    [optional]

       

    Comments feed Comment Feed RSS 2.0

    Sign up for the Web Development Daily Newsletter

    internet.com Privacy Policy
    We'll send this script to you!

    (just click "Send it!" once!)