- 15, May 2024
- #1
В коде моего аквариумного калькулятора есть ошибки. Вот исходный код:
<script type="text/javascript" src="[URL='https://lumtu.com/yti/a4ii4anNodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pb1mL']https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js[/URL]"></script>
<script type="text/javascript">
var result = 0;
var roundLength = 2;
function computeGallons()
{
result = Math.round((document.frmMain.TankLength.value * document.frmMain.TankWidth.value * document.frmMain.TankHeight.value / 231)*100)/100;
document.frmMain.USGallons.value = Math.round(result*100)/100;
}
</script>
<form name="frmMain"><span class="b">Aquarium Calculator: Calculate Rectangle Fish Tank Volume in Gallons Based on Tank Size</span><p>
Fish Tank Length in Inches:<br />
<input type="text" name="TankLength" onkeyup="computeGallons()"><br />
<br />
Fish Tank Width in Inches:<br />
<input type="text" name="TankWidth" onkeyup="computeGallons()"><br />
<br />
Fish Tank Height in Inches:<br />
<input type="text" name="TankHeight" onkeyup="computeGallons()"><br />
<br />
Aquarium Size is<br />
<input type="text" name="USGallons" style="border: none; background: #D8EFFF; padding: 12px; width: 10em; font-size: 18px;" readonly> US Gallons<br />
<br />
</form>
Код (JavaScript):