私は視覚化のための価格表を書いています。この価格表では、ユーザーはプロジェクトの機能、スタイル、レンダリングスタイル(フォトリアリスティック/コンセプチュアル/マケット)を選択することができ、同時にプロジェクトの総価格をリストの一番下に表示することができます。コードは価格を計算しない理由を私はいくつかの数学のコースを取るよりも、あなたには、いくつかのJSのマニュアルを読む必要があり、すべてのタイプミスのバグを修正した後...合計金額は変更されません。数値を変更している間に総金額の変更が見込まれますか?
<html>
<div id="RenderingTab" class="panel panel-default" >
<div class="panel-heading">
<h4 class="panel-title"><a data-toggle="collapse" data-
parent="#accordion1" href="#collapseTwo1">Render</a></h4>
</div>
<div id="collapseTwo1" class="panel-collapse collapse">
<form>
<div class="panel-body">Project style :<br>
<br>
<div class="col-lg-6" data-toggle="buttons">
<select id="prjstrndr" class="panel-title"
onchange="RndrPrcCalc(this);">
<option class="input-group-addon" value="1.3" id="rndr-mdrn"
onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="options" >
Modern </option>
<option class="input-group-addon" value="1" id="rndr-cls"
onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="options" >
Classic </option>
<option class="input-group-addon" value="1.8" id="rndr-trd"
onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="options" >
Traditional </option>
<option class="input-group-addon" value="0.9" id="rndr-param"
onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="options" >
Parametric </option>
<option class="input-group-addon" value="1.1" id="rndr-org"
onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="options" >
Organic </option>
</select>
</div>
</div>
</form>
<form>
<div class="panel-body">Project Function :<br>
<br>
<div class="col-lg-6" data-toggle="buttons">
<select id="prjfnrndr" class="panel-title"
onchange="RndrPrcCalc(this);">
<option class="input-group-addon" value="1.2" id="rndr-vll"
onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="style">
Villa </option>
<option class="input-group-addon" value="1" id="rndr-
apprtmnt" onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="style" >
Appartment </option>
<option class="input-group-addon" value="1.35" id="rndr-
cmmrcl" onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="style" >
Commercial </option>
<option class="input-group-addon" value="1.3" id="rndr-offcl"
onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="style" >
Official </option>
<option class="input-group-addon" value="1.25" id="rndr-othr"
onchange="RndrPrcCalc(this); RndrIntPrc(this);" name="style" >
Other </option>
</select>
</div>
</div>
</form>
<br>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><a data-toggle="collapse" data-
parent="#accordion3" href="#collapseTwo3"> Interior Rendering</a></h4>
</div>
<div id="collapseTwo3" class="panel-collapse collapse">
<div class="panel-body">
<br>
<div id="rndr-lobbyParam" >
<div class="input-group input-group-sm"><span
class="input-group-addon paramtitle">Lobby wall area </span>
<input type="number" min="0" step="0.01" id="rndr-int-
wall-area-lobby" class="form-control" onchange="RndrIntPrc();"
placeholder=" 0.00 sqm " required="required">
</div>
<br>
<div class="input-group input-group-sm"><span
class="input-group-addon paramtitle">Photo Realistic </span>
<div class="row">
<div class="col-lg-6">
<div class="input-group"><span class="input-group-
addon">Day</span>
<input type="number" min="0" id="rndr-int-real-
day-lobby" class="form-control" placeholder="0 Num"
onchange="RndrIntPrc();">
</div>
<!-- /input-group -->
</div>
<!-- /.col-lg-6 -->
<div class="col-lg-6">
<div class="input-group"><span class="input-group-
addon"> Night</span>
<input type="number" min="0" id="rndr-int-real-
nght-lobby" class="form-control" placeholder="0 Num"
onchange="RndrIntPrc();">
</div>
<!-- /input-group -->
</div>
<!-- /.col-lg-6 -->
</div>
</div>
<div class="input-group input-group-sm"><span
class="input-group-addon paramtitle">Conceptual</span>
<div class="row">
<div class="col-lg-6">
<div class="input-group"><span class="input-group-
addon">Day</span>
<input type="number" min="0" id="rndr-int-conc-
day-lobby" class="form-control" placeholder="0 Num"
onchange="RndrIntPrc();">
</div>
<!-- /input-group -->
</div>
<!-- /.col-lg-6 -->
<div class="col-lg-6">
<div class="input-group"><span class="input-group-
addon"> Night</span>
<input type="number" min="0" id="rndr-int-conc-
nght-lobby" class="form-control" placeholder="0 Num"
onchange="RndrIntPrc();">
</div>
<!-- /input-group -->
</div>
<!-- /.col-lg-6 -->
</div>
</div>
<div class="input-group input-group-sm"><span
class="input-group-addon paramtitle">Maket</span>
<div class="row">
<div class="col-lg-6">
<div class="input-group"><span class="input-group-
addon">Day</span>
<input type="number" min="0" id="rndr-int-mak-
day-lobby" class="form-control" placeholder="0 Num" onchange="RndrIntPrc();">
</div>
<!-- /input-group -->
</div>
<!-- /.col-lg-6 -->
<div class="col-lg-6">
<div class="input-group"><span class="input-group-
addon" disabled="disabled"> Night</span>
<input type="number" min="0" id="rndr-int-mak-
nght-lobby" class="form-control" placeholder="0 Num" disabled="disabled">
</div>
<br>
<label class="fa">Interior rendering Total price </label>
<input type="text" class="form-control" id="render-int-price"
placeholder= "0" readonly></input>
</html>
<script>
document.getElementById("prjstrndr").onchange = function()
{RndrIntPrc();};
document.getElementById("prjfnrndr").onchange = function()
{RndrIntPrc();};
document.getElementById("rndr-lobby").onchange = function()
{RndrIntPrc();};
document.getElementById("rndr-int-wall-area-lobby").onchange =
function() {RndrIntPrc();};
document.getElementById("rndr-int-real-day-lobby").onchange = function()
{RndrIntPrc();};
document.getElementById("rndr-int-real-nght-lobby").onchange =
function() {RndrIntPrc();};
document.getElementById("rndr-int-conc-day-lobby").onchange = function()
{RndrIntPrc();};
document.getElementById("rndr-int-conc-nght-lobby").onchange =
function()
{RndrIntPrc();};
document.getElementById("rndr-int-mak-day-lobby").onchange = function()
{RndrIntPrc();};
//interior render cost calculation:
var
RIRDL = document.getElementById("rndr-int-real-day-lobby"),
RIRNL = document.getElementById("rndr-int-real-nght-lobby"),
RICDL = document.getElementById("rndr-int-conc-day-lobby"),
RICNL = document.getElementById("rndr-int-conc-nght-lobby"),
RIMDL = document.getElementById("rndr-int-mak-day-lobby"),
Totalintrndr = 0;
document.getElementById('render-int-price').value = Totalintrndr;
var RndrIntPrc = function() {
var projectStylerndr = document.getElementById('prjstrndr').value,
projectFunctionrndr = document.getElementById('prjfnrndr').value,
RIWAL = document.getElementById("rndr-int-wall-area-lobby").value,
RIRDLNum = RIRDL.value,
RIRNLNum = RIRNL.value,
RICDLNum = RICDL.value,
RICNLNum = RICNL.value,
RIMDLNum = RIMDL.value,
XRL = 50000,
XCL = 25000,
XML = 10000,
var intNumD = [];
[RIRDLNum,RICDLNum,RIMDLNum].forEach(function(n, i) {
intNumD[i] = (n >= 2 && n < 5) ? n * 0.9 : n == 0 ? 0 : n == 1 ? 1 : n - 1;
});
var intNumN = [];
[RIRNLNum,RICNLNum].forEach(function(n, i) {
intNumN[i] = (n >= 2 && n < 5) ? n * 0.95 : n == 0 ? 0 : n == 1 ? 1.2 : n == 2 ? 1.9 : n - 1;
});
var Totalintrndr = projectStylerndr * projectFunctionrndr *
(Math.log(RIWAL)*((XRL)*(intNumD[0] + intNumN[0]) + (XCL)*(intNumD[1]
+ intNumN[1]) + (XML)*intNumD[2]));
document.getElementById('render-int-price').value =
(Totalintrndr>0 && Totalintrndr!=='NaN')?Totalintrndr:0;
};
</script>
かなり明白です。このコードではJavaScriptエラーの束、カンマで終わる行以下のvarラインがありますを参照してください、「rndr-ロビーは」」doesnのあなたの問題がちょうどそれらのバグを修正している場合は、ブラウザのコンソールを使って見つけて修正してください。問題がそれと無関係である場合は、まずコードを修正してテストしてください。 – James
問題はまだ存在します。 –