私の Web サイト フォームでは、var kwh_production
selectbox アイテムに接続された値に対して を乗算する必要があります。kwh_production
これは私のコードですが、選択した項目をチェックせず、最後の値 (0.27325) を乗算するだけなので機能しません
function earn_or_save() {
var eos = 0;
// erd modules
if ($('select_20').val() = 3025) eos = kwh_production * 0.28525
if ($('select_20').val() = 4407) eos = kwh_production * 0.28525
if ($('select_20').val() = 5809) eos = kwh_production * 0.28525
if ($('select_20').val() = 5850) eos = kwh_production * 0.27325
if ($('select_20').val() = 8724) eos = kwh_production * 0.27325
if ($('select_20').val() = 9320) eos = kwh_production * 0.27325
if ($('select_20').val() = 10464) eos = kwh_production * 0.27325
if ($('select_20').val() = 13649) eos = kwh_production * 0.27325
if ($('select_20').val() = 15938) eos = kwh_production * 0.27325
if ($('select_20').val() = 16326) eos = kwh_production * 0.27325
if ($('select_20').val() = 17612) eos = kwh_production * 0.27325
if ($('select_20').val() = 21288) eos = kwh_production * 0.27325
// europe modules
if ($('select_20').val() = 3289) eos = kwh_production * 0.28525
if ($('select_20').val() = 4882) eos = kwh_production * 0.28525
if ($('select_20').val() = 6410) eos = kwh_production * 0.28525
if ($('select_20').val() = 9350) eos = kwh_production * 0.27325
if ($('select_20').val() = 9350) eos = kwh_production * 0.27325
if ($('select_20').val() = 10481) eos = kwh_production * 0.27325
if ($('select_20').val() = 11463) eos = kwh_production * 0.27325
if ($('select_20').val() = 14745) eos = kwh_production * 0.27325
if ($('select_20').val() = 17269) eos = kwh_production * 0.27325
if ($('select_20').val() = 18285) eos = kwh_production * 0.27325
if ($('select_20').val() = 19772) eos = kwh_production * 0.27325
if ($('select_20').val() = 23653) eos = kwh_production * 0.27325
if (eos != 0) {
$("earn_or_save").set('text', "€ " + number_format(eos, 2, ',', '.'));
$("i_earn_or_save").value = number_format(eos, 2, '.', '');
}
else {
$("earn_or_save").set('text', "");
$("i_earn_or_save").value = 0;
}
}
$("select_20").addEvent('onChange', earn_or_save);