<tr> <td class="menu">何月のデータですか?</td> <td> <select name="speed" id="Month"> <option value="Month1">1月</option> <option value="Month2">2月</option> <option value="Month3">3月</option> <option value="Month4">4月</option> <option value="Month5">5月</option> <option value="Month6">6月</option> <option value="Month7">7月</option> <option value="Month8">8月</option> <option value="Month9">9月</option> <option value="Month10">10月</option> <option value="Month11">11月</option> <option value="Month12">12月</option> </select> </td> </tr> <input type="text" id="k" value="">好きな数字を入力してください<br> 答え:<output type="text" id="ans1" value=""><br> <br> <br> <br> <br> <input type="button" value="計算" onclick="fncCalc();"> <input type="reset" value="リセット"> </form> [script] function fncCalc() { var x = 7823.38; var k = document.getElementById('k').value; var x1 = 2873.38; var x2 = 395.08; var w = 7635; var w1 = 2775; var w2 = 355; var ans = 0.0; //月のデータ var Month1 = 1.2; var Month2 = 1.1; var Month3 = 1; var Month4 = 1; var Month5 = 1; var Month6 = 1; var Month7 = 1.2; var Month8 = 1.4; var Month9 = 1.2; var Month10 = 1; var Month11 = 1; var Month12 = 1.2; var a = Month; var b = ( Month1 / a + Month2 / a + Month3 / a + Month4 / a + Month5 / a + Month6 / a + Month7 / a + Month8 / a + Month9 / a + Month10 / a + Month11 / a + Month12 ) var c = b * ans1 ; var c1 = b * ans1 ; var c2 = b * ans1 ; if (k >= 300) { ans = (k - 300) * 28.8 + x; } else if (k >= 120) { ans = (k - 120) * 27.5 + x1; } else if (k >= 10) { ans = (k - 10) * 22.53 + x2; } else if (k < 10) { ans = 395.0; } var p = '料金は'; var i = '円です'; var p1 = '料金は'; var p2 = '差額は' document.getElementById('ans1').value = `${p}${Math.floor((k - 300 ) * 28.8 + x)}${i} ${p1}${Math.floor(k - 300 ) * 28 + w}${i} ${p2}${Math.floor((k - 300 ) * 28.8 + x) - ((k - 300 ) * 28 + w)}${i} ${}${c}${i}`; } [/script]
メニューで選択した項目の月のデータを割り振ってあり
好きな数字で出した料金を元に月のデータを使って年間の合計を出したいです
月によって料金の計算が違うようにしたいです
メニューと月のデータを繋ぎ方が良くわかりません
aはMonth1からMonth12までのどれか選択されたら選択された月のMonthにしたいです
そこどうやって置き換えるかわかりません
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。