diff options
author | Christian Weber | 2009-11-27 10:42:57 +0000 |
---|---|---|
committer | Christian Weber | 2009-11-27 10:42:57 +0000 |
commit | 93656aabcdb925fb14795f342e209bca59538f24 (patch) | |
tree | 11824651938f67d51a3572196e496cc14d153736 | |
parent | bdb6344bc56252553678c38bb550ab6fea64812c (diff) | |
download | itools-93656aabcdb925fb14795f342e209bca59538f24.tar.gz itools-93656aabcdb925fb14795f342e209bca59538f24.tar.bz2 itools-93656aabcdb925fb14795f342e209bca59538f24.zip |
ED() creates jsdebug div if it doesn't exist
-rw-r--r-- | itjs/it.js | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -15,41 +15,41 @@ function CED(txt) */ function ED() { - var element = document.getElementById('jsdebug'); - if (element) + var element; + var text = ""; + + if (!(element = document.getElementById('jsdebug'))) + var element = it_create_element(document.body, 'div', {id:'jsdebug', style:{position:'absolute', left:'100px', top:'10px', opacity:'0.8'}}) + + for (var i = 0; i < arguments.length; i++) { - var text = ""; + var variable = arguments[i]; - for (var i = 0; i < arguments.length; i++) - { - var variable = arguments[i]; + if (typeof variable == "string") + variable = variable.replace(/&/g, '&').replace(new RegExp("<", "g"), '<'); - if (typeof variable == "string") - variable = variable.replace(/&/g, '&').replace(new RegExp("<", "g"), '<'); + text += (typeof variable) + " " + variable; - text += (typeof variable) + " " + variable; + if (typeof variable == "object") + { + text += ":"; - if (typeof variable == "object") + for (field in variable) { - text += ":"; - - for (field in variable) - { - text += field + "="; + text += field + "="; - try { text += typeof variable[field] == 'function' ? 'function' : variable[field]; } - catch (e) { text += "*" + e + "*"; } + try { text += typeof variable[field] == 'function' ? 'function' : variable[field]; } + catch (e) { text += "*" + e + "*"; } - text += "\n"; - } text += "\n"; } - text += "\n"; } - element.innerHTML += '<pre style="background-color:#FEE; margin:0">' + text + '<' + '/pre>'; + text += "\n"; } + + element.innerHTML += '<pre style="background-color:#FEE; margin:0">' + text + '<' + '/pre>'; } /** |