Stay Tuned!

Subscribe to our newsletter to get our newest articles instantly!

JavaScript

JavaScript Program to Calculate the Total of Length, Width & Height

Total of Length

Write a JavaScript Program to Calculate the Total of Length, Width, and Height. Write javascript code to calculate the volume if the length, breadth and height are given by the user with the help of form.

<html>

<head>

<script>

  function calculatevolume(length, width, height) {

    volume =  width * height * length

    return volume

  }

</script>

</head>

<body>

<form name="volfrm">

Length<input type="text" name="txtlength"/><br />

Width<input type="text" name="txtwidth" /><br />

Height<input type="text" name="txtheight"/><br />

<input type="submit" value="calculate" onClick="alert(calculatevolume(document.volfrm.txtlength.value, document.volfrm.txtwidth.value, document.volfrm.txtheight.value))" />

</form>

</body>

</html>
Avatar

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

You may also like

javascript
JavaScript

JavaScript – Introduction, History, and Syntax

  • September 17, 2020
What is “JavaScript”? The first appearance of JavaScript was made in Netscape 2.0 in 1995 with a name Live Script.
javascript
JavaScript

JavaScript – Write Program to Print Hello World!!!

  • September 17, 2020
JavaScript is scripting language which is similar to C. It is syntax and logic are similar to C, C++ and