js计算胎儿体重的代码

js实现胎儿体重计算器的方法,js计算胎儿体重的代码教程如下:

1.输入胎儿双顶径

2.输入胎儿腹围周长

3.输入胎儿腹前后径

4.输入胎儿股骨长

实现结果:测算出胎儿体重

js实现代码如下:

function setKeyup(obj) {
if (!obj.value) return false;
re = /^[\d\.]+$/
if (!re.test(obj.value)) {
alert("鐠囩柉绶崗銉╂▼閹峰闆嗛弫鏉跨摟");
obj.value = "";
}
}

function onlyread(objid1, objid2) {
document.getElementById(objid1).readOnly = false;
document.getElementById(objid2).readOnly = true;
document.getElementById(objid1).disabled = false;
document.getElementById(objid2).disabled = true;
document.getElementById(objid1).style.backgroundColor = "";
document.getElementById(objid2).style.backgroundColor = "buttonface";
document.getElementById(objid1).focus();
}

function ForDight(Dight, How) {
Dight = Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How);
return Dight;
}

function getWei() {
if (!document.getElementById("bdp").value) {
alert('璇疯緭鍏ュ弻椤跺緞鍊�'); document.getElementById("bdp").focus();
return;
}
if ((!document.getElementById("ac").value) && !document.getElementById('zj').value) {
alert('璇疯緭鍏ヨ吂鍥村€�');
return;
}
if (!document.getElementById("fl").value) {
alert('璇疯緭鍏ヨ偂楠ㄩ暱鍊�');
document.getElementById("fl").focus();
return;
}
BDP = document.getElementById("bdp").value / 10;
AC = (document.getElementById('mode').checked) ? document.getElementById("ac").value / 10 : document.getElementById('zj').value * 0.314;
FL = document.getElementById("fl").value / 10;
wei = 1.07 * BDP * BDP * BDP + 0.3 * AC * AC * FL;
jin = ForDight(wei / 500, 2);
document.getElementById("wtext").innerHTML = '鑳庡効浣撻噸浼扮畻绾� <b class="red">'+jin+'</b> 鏂�';
document.getElementById('wresult').style.display = '';

var c = document.getElementById('wresult').innerHTML;
var i = '';
return {c:c, i:i};
}

function wInit() {
document.getElementById('mode').checked = true;
document.getElementById('mode').click();
document.getElementById('bdp').focus();
document.getElementById('wtext').innerHTML = '';
document.getElementById('wresult').style.display = 'none';
}

function handleWork(obj) {
var v = obj.value;
obj.disabled = true;
obj.value = '澶勭悊涓�';

// global callback
handleBegin();

var res = getWei();

if (typeof res == 'object' && res != null) {
// global callback
handleFinish(res.c, res.i);
}

obj.value = v;
obj.disabled = false;
}

$(document).ready(function(){
var w_t = '^_^鐠囬攱鍋嶆繅顐㈠晸娴犮儰绗呴崘鍛啇閿涘本鏌熸笟鑳唨婵劕顬呮禒顒€寮懓鍐ф唉濞翠礁鎽濋敍锟�<br>'
+'1.娴g姴顕拠銉︾ゴ鐠囨洜绮ㄩ弸婊勬Ц閸氾附寮ч幇蹇ョ窗<br><br>'
+'2.閹劍妲搁崥锔胯礋閼冲骸鍔归惃鍕灇闂€鎸庡妳閸掔増顐鹃崰婊愮窗<br><br>'
+'3.閹劌绗囬張娑滃殰瀹歌京娈戠€规繂鐤傞崙铏规晸閺冩儼鍏橀張澶婎樋闁插稄绱�<br><br>';
// global callback
handleInit(w_t);

wInit();
});

显示效果:胎儿体重计算器

参考文章:http://tishang.net/articles/1685607137.html

生男生女清宫图

儿童身高计算器

公历农历转换

今日黄历查询

干支纪年换算

功率单位换算器

posted @ 2023-06-01 16:30  kaiser099  阅读(1)  评论(0编辑  收藏  举报