Web Program/Html Lecture
스크립터 디버거
by 현이빈이
2008. 9. 4.
/**
* * */
var oLogWin, oLogger;
var lPreTime;
function makeLogger(oLogWin, sID) {
var oLogDoc = oLogWin.document;
var oTextArea = oLogDoc.getElementById(sID);
if (!oTextArea) {
oTextArea = oLogDoc.createElement("TEXTAREA");
oLogDoc.body.insertBefore(oTextArea,null);
oTextArea.id = sID;
oTextArea.style.height = oLogDoc.body.clientHeight - 20;
oTextArea.style.width = oLogDoc.body.clientWidth;
oTextArea.style.font = "9pt Arial";
}
return oTextArea;
}
function log(str, bTime) {
if (!oLogWin || oLogWin.closed) {
oLogWin = window.open("","LogWin","top=5,left=5,width=350,height=400,resizable");
oLogDoc = oLogWin.document;
var sScript = ""
+ "Script Loggger | "
+ ""
+ "clear"
+ " |
";
oLogDoc.write(sScript);
oLogDoc.body.style.margin = "0,0,0,0";
oLogger = makeLogger(oLogWin, "LogArea");
lPreTime = new Date().getTime();
}
var sTime = new Date().getTime() - lPreTime;
if (bTime) {
lPreTime = new Date().getTime();
}
oLogger.value += "time : " + sTime + "\t> " + str + "\n";
oLogger.scrollTop = oLogger.scrollHeight - oLogger.clientHeight;
}