title: Javascript replace special chars with empty strings
body: <p>Ok, I have these string prototypes to work with, however, I don't understand what they do exactly.</p>
  
  <pre><code>String.prototype.php_htmlspecialchars = function()
  {
   return this.replace(/&amp;/g, '&amp;amp;').replace(/&lt;/g, '&amp;lt;').replace(/&gt;/g, '&amp;gt;').replace(/"/g, '&amp;quot;');
  }
  
  String.prototype.php_unhtmlspecialchars = function()
  {
   return this.replace(/&amp;quot;/g, '"').replace(/&amp;gt;/g, '&gt;').replace(/&amp;lt;/g, '&lt;').replace(/&amp;amp;/g, '&amp;');
  }
  
  String.prototype.php_addslashes = function()
  {
   return this.replace(/\\/g, '\\\\').replace(/'/g, '\\\'');
  }
  
  String.prototype._replaceEntities = function(sInput, sDummy, sNum)
  {
   return String.fromCharCode(parseInt(sNum));
  }
  
  String.prototype.removeEntities = function()
  {
   return this.replace(/&amp;(amp;)?#(\d+);/g, this._replaceEntities);
  }
  
  String.prototype.easyReplace = function (oReplacements)
  {
   var sResult = this;
   for (var sSearch in oReplacements)
    sResult = sResult.replace(new RegExp('%' + sSearch + '%', 'g'), oReplacements[sSearch]);
  
   return sResult;
  }
  </code></pre>
  
  <p>Basically, what I need to do is replace all instances of double quotes ("), >, &lt;, single quotes ('), etc. etc..  Basically the same stuff that htmlentities() in php changes, but I need to replace them with an empty string, so that they are removed from the text.</p>
  
  <p>Can I use any of the functions above?  If not, how can I accomplish this in Javascript?  Can I use a replace on the string?</p>
  
  <p>Please, someone, help me here.  I am placing this text into a select box and will be inputted into the database upon submitting of the form.  Though, I am using PHP to remove all of these characters, however, I'm having difficulty finding a way to do this in Javascript.</p>
  
  <p>Thanks :)</p>