Created
April 15, 2010 16:47
-
-
Save sugamasao/367345 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(obj) { | |
var idName="asLoggerConsole"; | |
var idLineName="asLoggerConsoleLine"; | |
var d = document; | |
var div = d.getElementById(idName); | |
if(!div) { | |
div = d.createElement("div"); | |
div.id = idName; | |
div.class = idName + "Class"; | |
d.body.appendChild(div) | |
} | |
var createLogLine = function(message) { | |
var d = document; | |
var p = d.createElement("p"); | |
p.id = idLineName + "_" + d.getElementById(idName).childElementCount; | |
p.class = idLineName + "Class"; | |
p.appendChild(d.createTextNode(message)); | |
p.style["margin"] = 0; | |
p.style["padding"] = 0; | |
return p; | |
} | |
var objToText = function(obj) { | |
return obj.toString(); | |
} | |
div.appendChild(createLogLine(objToText(obj))); | |
})("aa") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment