Created
August 16, 2011 04:16
-
-
Save sakunyo/1148429 to your computer and use it in GitHub Desktop.
log
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 PrintLog(p){ | |
var d = document, | |
df = d.createDocumentFragment(), | |
p = p || 'result', | |
r = d.getElementById(p); | |
return function(s){ | |
df.appendChild(d.createTextNode(s)); | |
df.appendChild(d.createElement('br')); | |
r.appendChild(df); | |
} | |
} | |
// sample | |
// constractor option is document.getElementById(option); | |
var log = new PrintLog('result'); | |
log('hoge'); | |
log('hogehogehoge'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment