body
Javascript, не могу понять, почему код не работает
<form>I want to know the
<select id="birthdeath">
<option value="birth">birth rate</option>
<option value="death">death rate</option>
</select>
<p></p>of
<select id="country">
<option value="neth">Netherlands</option>
<option value="ger">Germany</option>
<option value="france">France</option>
<option value="bras">Brasil</option>
</select>
in: <input type="text" maxlength="3" size="3" id="years" placeholder="21"/> years
<p></p>
<input id="calculate" type="button" value="calculate!" />
</form>
<p> </p>
<div id="div2">The birth or death rate of your country will be ... </div>
</div>
</div>
<script type="text/javascript">
var number = {
birth: {
neth: 11,
france: 13,
ger:8,
bras: 17,
},
death: {
neth: 8,
france: 9,
ger: 11,
bras: 6,
}
};
document.getElementById('calculate').addEventListener('click', function() {
var birthdeath = document.getElementById('birthdeath').value;
var nationality = document.getElementById('country').value;
var new = new [birthdeath][nationality]
var total=Math.round(new*1.10)
document.getElementById('div2').innerHTML = "The birth/ death rate of your country will be <b>" + total + "</b>.";
}, false);</script>
</body>
Что такое 'новый [birthdeath] [национальности]'? и как бы вы умножили это, * что бы это ни было, числом? – Claies