title: Uncaught ReferenceError: Invalid left-hand side in assignment
body: <p>I am receiving this error from my JavaScript code:</p>
  
  <pre><code>Uncaught ReferenceError: Invalid left-hand side in assignment 
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function repartition()
  {
      var principal_p             = &lt;?php echo $data23['principal_p'] ;?&gt;; 
      var principal_c             = &lt;?php echo $data23['principal_c'] ;?&gt;; 
      var interets_p              = &lt;?php echo $data23['interets_p'] ;?&gt;; 
      var interets_c              = &lt;?php echo $data23['interets_c'] ;?&gt;; 
      var clause_penale_p         = &lt;?php echo $data23['clause_penale_p'] ;?&gt;; 
      var clause_penale_c         = &lt;?php echo $data23['clause_penale_c'] ;?&gt;;
      var domages_interets_p      = &lt;?php echo $data23['domages_interets_p'] ;?&gt;;
      var domages_interets_c      = &lt;?php echo $data23['domages_interets_c'] ;?&gt;;
      var art700_cpc_p            = &lt;?php echo $data23['art700_cpc_p'] ;?&gt;;
      var art700_cpc_c            = &lt;?php echo $data23['art700_cpc_c'] ;?&gt;;
      var art475_1_cpp_p          = &lt;?php echo $data23['art475_1_cpp_p'] ;?&gt;;
      var art475_1_cpp_c          = &lt;?php echo $data23['art475_1_cpp_c'] ;?&gt;;
      var art_441_6_cc_p          = &lt;?php echo $data23['art_441_6_cc_p'] ;?&gt;;
      var art_441_6_cc_c          = &lt;?php echo $data23['art_441_6_cc_c'] ;?&gt;;
      var frais_ar_p              = &lt;?php echo $data23['frais_ar_p'] ;?&gt;; 
      var frais_ar_c              = &lt;?php echo $data23['frais_ar_c'] ;?&gt;;
      var agios_p                 = &lt;?php echo $data23['agios_p'] ;?&gt;; 
      var agios_c                 = &lt;?php echo $data23['agios_c'] ;?&gt;;
      var depens_p                = &lt;?php echo $data23['depens_p'] ;?&gt;; 
      var depens_c                = &lt;?php echo $data23['depens_c'] ;?&gt;;   
      var frais_execution_p       = &lt;?php echo $data23['frais_execution_p'] ;?&gt;; 
      var frais_execution_c       = &lt;?php echo $data23['frais_execution_c'] ;?&gt;;  
      var contrib_aid_juridiq_p   = &lt;?php echo $data23['contrib_aid_juridiq_p'] ;?&gt;;
      var contrib_aid_juridiq_c   = &lt;?php echo $data23['contrib_aid_juridiq_c'] ;?&gt;;  
      var frais_greffe_p          = &lt;?php echo $data23['frais_greffe_p'] ;?&gt;;
      var frais_greffe_c          = &lt;?php echo $data23['frais_greffe_c'] ;?&gt;;
      principal = document.getElementsByName("principal_s");
      document.getElementsById(nprincipal)= (principal*principal_p)/100;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The line that causes the error is the line with <code>document.getElementsById</code> in it.  Why is it causing the error?</p>