Skip to content

Instantly share code, notes, and snippets.

@sakunyo
Created August 16, 2011 04:16
Show Gist options
  • Save sakunyo/1148429 to your computer and use it in GitHub Desktop.
Save sakunyo/1148429 to your computer and use it in GitHub Desktop.
log
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