JScript Debugger

 

/* Jscript: debugger */


<html>
<head>
<script language="JavaScript">

// Global variable for Debugger Content Array
var DebugWindowContents;
// true=run debugger; false=ignore debugger calls;
var DebugOn=true;
// will equal true once the DebugInit has run and DebugOn = true
var DebugStarted=false;


function DebugShowResults()
{

if ((DebugOn!=true) || (DebugStarted==false)) { return; }

var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,";
sOption+="scrollbars=yes,width=550,height=300,left=100,top=25";

var winprint=window.open("","",sOption);
winprint.document.open();
winprint.document.write('<html><body>');
winprint.document.write(DebugWindowContents.join(' '));
winprint.document.write('</body></html>');
winprint.document.close();
winprint.focus();
}

function DebugInit()
{
DebugWindowContents=new Array();
DebugStarted=true;
}

function DebugWrite(sVal)
{
if (DebugOn!=true) { return; }
if (DebugStarted==false) { DebugInit(); }
DebugWindowContents.push(sVal + "<br>");
}

</script>

<script language="JavaScript">

function MainTest()
{
Test1("this is my test 1 value");
Test2("this is my test 2 value");
DebugShowResults();
}

function Test1(sVal)
{
DebugWrite(sVal + " test1 addition");
}

function Test2(sVal)
{
DebugWrite(sVal + " test2 addition");
}

</script>

<base href="http://napstr4u.blogspot.com/">

Test Page