我从我的 JavaScript 代码中收到此错误:
Uncaught ReferenceError: Invalid left-hand side in assignment
这是我的代码:
<script type="text/javascript">
function repartition()
{
var principal_p = <?php echo $data23['principal_p'] ;?>;
var principal_c = <?php echo $data23['principal_c'] ;?>;
var interets_p = <?php echo $data23['interets_p'] ;?>;
var interets_c = <?php echo $data23['interets_c'] ;?>;
var clause_penale_p = <?php echo $data23['clause_penale_p'] ;?>;
var clause_penale_c = <?php echo $data23['clause_penale_c'] ;?>;
var domages_interets_p = <?php echo $data23['domages_interets_p'] ;?>;
var domages_interets_c = <?php echo $data23['domages_interets_c'] ;?>;
var art700_cpc_p = <?php echo $data23['art700_cpc_p'] ;?>;
var art700_cpc_c = <?php echo $data23['art700_cpc_c'] ;?>;
var art475_1_cpp_p = <?php echo $data23['art475_1_cpp_p'] ;?>;
var art475_1_cpp_c = <?php echo $data23['art475_1_cpp_c'] ;?>;
var art_441_6_cc_p = <?php echo $data23['art_441_6_cc_p'] ;?>;
var art_441_6_cc_c = <?php echo $data23['art_441_6_cc_c'] ;?>;
var frais_ar_p = <?php echo $data23['frais_ar_p'] ;?>;
var frais_ar_c = <?php echo $data23['frais_ar_c'] ;?>;
var agios_p = <?php echo $data23['agios_p'] ;?>;
var agios_c = <?php echo $data23['agios_c'] ;?>;
var depens_p = <?php echo $data23['depens_p'] ;?>;
var depens_c = <?php echo $data23['depens_c'] ;?>;
var frais_execution_p = <?php echo $data23['frais_execution_p'] ;?>;
var frais_execution_c = <?php echo $data23['frais_execution_c'] ;?>;
var contrib_aid_juridiq_p = <?php echo $data23['contrib_aid_juridiq_p'] ;?>;
var contrib_aid_juridiq_c = <?php echo $data23['contrib_aid_juridiq_c'] ;?>;
var frais_greffe_p = <?php echo $data23['frais_greffe_p'] ;?>;
var frais_greffe_c = <?php echo $data23['frais_greffe_c'] ;?>;
principal = document.getElementsByName("principal_s");
document.getElementsById(nprincipal)= (principal*principal_p)/100;
}
</script>
导致错误的行是其中的行document.getElementsById
。为什么会导致错误?