<!DOCTYPE html>
<html>
<body>
<p id="par"><p>
<p id="rig"><p>
<p id="af"><p>
<p id="riv"><p>
<form>
Paris:
<input type="text" name="Paris">
<br/><br/>
Riga:
<input type="text" name="Riga">
<br/><br/>
Afine:
<input type="text" name="Afine">
<br/><br/>
</form>
<button onclick="f()">Result!</button>
<script>
function f(x,y,z,a,b,c,f,g,h,r,s,q) {
var Paris = (a * x) + (b * y) + (c * z);
document.getElementById("par").innerHTML = Paris + 'Paris';
var Riga = (a * f) + (b * g) + (c * h);
document.getElementById("rig").value = Riga;
var Afine = (a * r) + (b * s) + (c * q);
document.getElementById("af").value = Afine;
document.getElementById("riv").innerHTML = "The best solution is travelling to " + ' ' + Math.max(Paris,Riga,Afine);
/*document.getElementById("par").innerHTML = ' ' + Paris;
document.getElementById("rig").innerHTML = ' ' + Riga;
document.getElementById("af").innerHTML = ' ' + Afine;*/
}
</script>
</body>
</html>
|