Image

Imagecherdt wrote in Imagejavascript

Listens: The Missing, Ministry

Debugging idea

I got tired of clicking OK on a dozen alert statements when I was trying to debug some troublesome javascript, so I came up with this simple alternative:
function dump(descr,value) {
    // This function dumps javascript data to the page, if a place for it exists.
    if (document.getElementById("dump")) 
        document.getElementById("dump").innerHTML+=descr+": "+value+"<br>";
}

So long as you have an element with an ID of "dump", e.g.
<div id="dump"></div>

You can view the values of troublesome variables on the page like so:
dump("troublesomeVar",troublesomeVar);