Sha256: dbc297ba3a751fd9c27bb87a1f81cc06cb587c9ab09eba831d87ad3833fe5f2c
Contents?: true
Size: 866 Bytes
Versions: 7
Compression:
Stored size: 866 Bytes
Contents
var error_log = function(data){ log("<span class='error'>" + data + '</div>') } var log = function(data){ var new_element = document.createElement('div'); new_element.innerHTML = data; document.getElementById('log_output').appendChild(new_element); }; var clear_log = function(){ document.getElementById('log_output').innerHTML=''; } /* * To avoid any kind of name conflict I am renaming trim to javascript_lab_trim * http://developer.loftdigital.com/blog/trim-a-string-in-javascript */ String.prototype.javascript_lab_trim = function() { return this.replace(/^\s+|\s+$/g, ''); } var processForm = function(){ try { var javascript_code = document.lab.javascript_code.value.javascript_lab_trim(); eval(javascript_code); }catch(e){ var error_text = 'Error: '+ e.name + ' ' + e.message; error_log(error_text); } return false; };
Version data entries
7 entries across 7 versions & 1 rubygems