如何计算jquery中的人体高度? [英] How to calculate human being height in jquery?

查看:60
本文介绍了如何计算jquery中的人体高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如何计算jquery中的人类身高。我有三个文本框用于以厘米,英寸,英尺为单位输入高度值。我为脚写了一些代码,它运行正常。但我想将英寸转换为英尺,英尺和厘米,转换为英尺,英尺。

以下是我的代码



Hi All,
How to calculate human being height in jquery. I have three textbox for entering the value for height in cms,inches,foot. I wrote some code for foot it is working fine. But i want to convert from inches to foot,cms and cms to inches,foot.
Below is my code

var feet = 0;
var inch = 0;
var cms = 0;
$('.feet').each(function () {
   if ($(this).val() != '' && $.isNumeric($(this).val())) {
       inch = parseFloat($(this).val() * 12);
       cms = parseFloat($(this).val() * 30.48);
   }
});
if (inch != 0 && cms != 0) {
   $("#<%=txtInches.ClientID%>").val(inch);
   $("#<%=txtCms.ClientID %>").val(cms);
}
else {
   $("#<%=txtInches.ClientID%>").val('');
   $("#<%=txtCms.ClientID %>").val(cms);
}
return false;
working above code
-----------------------------------------------------------------------------------
$('.inch').each(function () {
   if ($(this).val() != '' && $.isNumeric($(this).val())) {
       feet = parseFloat($(this).val() * 0.08);
       cms = parseFloat($(this).val() * 2.54);
       alert(parseFloat($(this).val() * 0.08));
       alert(cms);
   }
});

if (feet != 0 && cms != 0) {
   $("#<%=txtFeet.ClientID%>").val(feet);
   $("#<%=txtCms.ClientID %>").val(cms);
}
else {
   $("#<%=txtInches.ClientID%>").val('');
   $("#<%=txtCms.ClientID %>").val('');
}
return false;







请尽早回复我





谢谢

Hari




Please reply me as early as possible


Thanks
Hari

推荐答案

' < span class =code-string>。feet')。each( function (){
if
('.feet').each(function () { if (


this )。val()!= ' '&&
(this).val() != '' &&


.isNumeric(
.isNumeric(


这篇关于如何计算jquery中的人体高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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