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.




  function calculatevolume(length, width, height) {

    volume =  width * height * length

    return volume





<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))" />





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

You may also like


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 – 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