📄 cook42.htm
字号:
<html>
<head>
<title>检测健康程度</title>
<style type="text/css">
<!--
body { font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 4px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: none }
A:hover { COLOR: red; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active { font: 9pt "宋体"; cursor: hand; color: #FF0033 }
--></style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#fef4d9">
<br>
<br>
<center><font color=red face="隶书" size=6>检测健康程度</font></center>
<br>
<center>
<table border=5 bordercolor=blue borderlight=green>
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面框中为脚本显示区</strong></font></td></tr>
<tr><td align=center height=80><script LANGUAGE="JAVASCRIPT">
<!-- hide this script tag's contents from old browsers
function ClearForm(form){
form.weight.value = "";
form.height.value = "";
form.bmi.value = "";
form.my_comment.value = "";
}
function bmi(weight, height) {
bmindx=weight/eval(height*height);
return bmindx;
}
function checkform(form) {
if (form.weight.value==null||form.weight.value.length==0
|| form.height.value==null||form.height.value.length==0){
alert("\nPlease complete the form first");
return false;
}
else if (parseFloat(form.height.value) <= 0||
parseFloat(form.height.value) >=500||
parseFloat(form.weight.value) <= 0||
parseFloat(form.weight.value) >=500){
alert("\nReally know what you're doing? \nPlease enter values again. \nWeight in kilos and \nheight in cm");
ClearForm(form);
return false;
}
return true;
}
function computeform(form) {
if (checkform(form)) {
yourbmi=Math.round(bmi(form.weight.value, form.height.value/100));
form.bmi.value=yourbmi;
if (yourbmi >30) {
form.my_comment.value="不要在闹了!!!";
}
else if (yourbmi >28 && yourbmi <=30) {
form.my_comment.value="您是猪吗?";
}
else if (yourbmi >23 && yourbmi <=28) {
form.my_comment.value="两头猪也没有你重吧?";
}
else if (yourbmi >21 && yourbmi <=23) {
form.my_comment.value="您现在是偏胖,应该注意饮食!";
}
else if (yourbmi >=19 && yourbmi <=21) {
form.my_comment.value="哇!!!您太苗条了! 是标准身材";
}
else if (yourbmi >=18 && yourbmi <19) {
form.my_comment.value="您是不是营养不良?????";
}
else if (yourbmi >=17 && yourbmi <18) {
form.my_comment.value="这个不是骨头吗????";
}
else if (yourbmi <17) {
form.my_comment.value="按照生物学来说这种生物是不能生存的";
}
}
return;
}
// -- done hiding from old browsers -->
</script>
<form NAME="BMI" method="POST">
<table border="1">
<tr>
<td><font color="red"><div align="center"><center><p>体重</font> (kg)</td>
<td align="center"><font color="red"><div align="center"><center><p>身高</font>(cm)</td>
<td align="center"><font color="blue"><div align="center"><center><p>健康值</font></td>
<td align="center"><font color="blue"><div align="center"><center><p>电脑对您的评价</font></td>
</tr>
<tr align="center">
<td><input TYPE="TEXT" NAME="weight" SIZE="6" onFocus="this.form.weight.value=''"></td>
<td><input TYPE="TEXT" NAME="height" SIZE="6" onFocus="this.form.height.value=''"></td>
<td><input TYPE="TEXT" NAME="bmi" SIZE="5"></td>
<td><input TYPE="TEXT" NAME="my_comment" size="40"></td>
</tr>
</table>
<div align="center"><center><p><input TYPE="button" VALUE="确定"
onClick="computeform(this.form)"> <input TYPE="reset" VALUE="取消"
onClick="ClearForm(this.form)"> </p>
</center></div>
</form>
</td></tr></table></center>
<br>
<br>
<center>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide
function goHist(a)
{
history.go(a);
}
//-->
</script>
<FORM METHOD="post">
<INPUT TYPE="button" VALUE="返回" onClick="goHist(-1)" style="background-color: #8000FF; color: rgb(255,255,255)">
</form>
</center>
<br>
<center>
<textarea name=source rows=12 cols=55 class=yk9>
脚本说明:
把如下代码加入<body>区域中:
<script LANGUAGE="JAVASCRIPT">
<!-- hide this script tag's contents from old browsers
function ClearForm(form){
form.weight.value = "";
form.height.value = "";
form.bmi.value = "";
form.my_comment.value = "";
}
function bmi(weight, height) {
bmindx=weight/eval(height*height);
return bmindx;
}
function checkform(form) {
if (form.weight.value==null||form.weight.value.length==0
|| form.height.value==null||form.height.value.length==0){
alert("\nPlease complete the form first");
return false;
}
else if (parseFloat(form.height.value) <= 0||
parseFloat(form.height.value) >=500||
parseFloat(form.weight.value) <= 0||
parseFloat(form.weight.value) >=500){
alert("\nReally know what you're doing? \nPlease enter values again. \nWeight in kilos and \nheight in cm");
ClearForm(form);
return false;
}
return true;
}
function computeform(form) {
if (checkform(form)) {
yourbmi=Math.round(bmi(form.weight.value, form.height.value/100));
form.bmi.value=yourbmi;
if (yourbmi >30) {
form.my_comment.value="不要在闹了!!!";
}
else if (yourbmi >28 && yourbmi <=30) {
form.my_comment.value="您是猪吗?";
}
else if (yourbmi >23 && yourbmi <=28) {
form.my_comment.value="两头猪也没有你重吧?";
}
else if (yourbmi >21 && yourbmi <=23) {
form.my_comment.value="您现在是偏胖,应该注意饮食!";
}
else if (yourbmi >=19 && yourbmi <=21) {
form.my_comment.value="哇!!!您太苗条了! 是标准身材";
}
else if (yourbmi >=18 && yourbmi <19) {
form.my_comment.value="您是不是营养不良?????";
}
else if (yourbmi >=17 && yourbmi <18) {
form.my_comment.value="这个不是骨头吗????";
}
else if (yourbmi <17) {
form.my_comment.value="按照生物学来说这种生物是不能生存的";
}
}
return;
}
// -- done hiding from old browsers -->
</script>
<form NAME="BMI" method="POST">
<table border="1">
<tr>
<td><font color="red"><div align="center"><center><p>体重</font> (kg)</td>
<td align="center"><font color="red"><div align="center"><center><p>身高</font>(cm)</td>
<td align="center"><font color="blue"><div align="center"><center><p>健康值</font></td>
<td align="center"><font color="blue"><div align="center"><center><p>电脑对您的评价</font></td>
</tr>
<tr align="center">
<td><input TYPE="TEXT" NAME="weight" SIZE="6" onFocus="this.form.weight.value=''"></td>
<td><input TYPE="TEXT" NAME="height" SIZE="6" onFocus="this.form.height.value=''"></td>
<td><input TYPE="TEXT" NAME="bmi" SIZE="5"></td>
<td><input TYPE="TEXT" NAME="my_comment" size="40"></td>
</tr>
</table>
<div align="center"><center><p><input TYPE="button" VALUE="确定"
onClick="computeform(this.form)"> <input TYPE="reset" VALUE="取消"
onClick="ClearForm(this.form)"> </p>
</center></div>
</form>
</textarea>
<br>
<br>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -