Area of a Triangle

Base:

Area of a Triangle

Base:

Area of a Triangle

Base:

خرید بک لینک
HTML File

<!DOCTYPE html>
<html>
<head>
<title>Area of a Triangle</title>
</head>
<body>
<h1>Area of a Triangle</h1>
<p>
Base: <input type="text" size="4" id="base">
Height: <input type="text" size="4" id="height">
<br>
<button type="button" onclick="triangleArea()">AREA</button>
</p>
<p id="output"> </p>

<script src = "triangleArea.js"></script>

</body>
</html>



traingle.js

var triangleArea = function () {
var base = parseFloat(document.getElementById('base').value);
var height = parseFloat(document.getElementById('height').value);

var output = document.getElementById('output');

if (isNan(base) || isNan(height)) {
output.textContent = 'You did not enter two number';
}else
{
var area = 0.5 * base * height;
output.textContent = 'Area = ' + area;
}
};

برچسب: نویسنده: آیلین رضوانی تاريخ: سه شنبه 12 دی 1396 ساعت: 13:37

صفحه بندی