Javascript:从宽度,长度和深度的体积计算器 [英] Javascript: volume calculator from width, length and depth

查看:110
本文介绍了Javascript:从宽度,长度和深度的体积计算器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家!



我需要根据这些输入创建一个在线计算器:宽度,长度和高度,并以m³显示答案。长度和宽度测量单位为米,高度(这是一个棘手的部分)以厘米为单位。



从互联网上找到该代码的基础并进行了一些修改。 (查看JSFiddle /)。基本上它做我需要的 - 从三个值计算总和(前两个以米为单位,第三个以厘米为单位),但我希望它更简单。我不希望在高度(厚度)字段的末尾有选择选项。这个值:





hi experts!

I need to create an online calculator from these inputs: width, length and height, and display the answer in m³. The length and width measurs are in meters, the height (this is a tricky part) in centemeters.

Found the base of that code from internet and modified a bit. (Look into JSFiddle/). Basically it does what i need – calculates the sum from three values (first two are in meters, third in centemeters), but i would like it to be more simpler. I don’t want "select options" at the end of a height (thickness) field. this value:


..else if(select_val == "meter"){
    result = result/100;
    $("#answer").text(result).append(" m<sup>3</sup>");;...







默认必须编入代码!

请帮我简化代码!或者你可以提供更优雅的解决方案?



我的英语不好,但我仍然希望你理解我的要求



我尝试了什么:



我自己试图解决它,但是......不能




must have programmed into code by default!
please help me to simplify that code! or maybe you can provide more elegant solution?

my english is not good, but i still hope you understood my request

What I have tried:

tried to solve it myself, but... couldn't

推荐答案

(#answer)。text(result).append(m< sup> 3< / sup>);; ...
("#answer").text(result).append(" m<sup>3</sup>");;...







默认必须编入代码!

请帮我简化代码!或者你可以提供更优雅的解决方案?



我的英语不好,但我仍然希望你理解我的要求



我尝试了什么:



我自己试图解决它,但是......不能




must have programmed into code by default!
please help me to simplify that code! or maybe you can provide more elegant solution?

my english is not good, but i still hope you understood my request

What I have tried:

tried to solve it myself, but... couldn't


简化

计算器 - JSFiddle [ ^ ]


这篇关于Javascript:从宽度,长度和深度的体积计算器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆