为了账号安全,请及时绑定邮箱和手机立即绑定

谁可以帮我找一下错误啊,顺便翻译,急用啊,各位高手拜托了

谁可以帮我找一下错误啊,顺便翻译,急用啊,各位高手拜托了

慕斯王 2018-12-06 13:01:12
<html><head><title>检测健康程度</title> <SCRIPT LANGUAGE="JAVASCRIPT"><!--var ap_name = navigator.appName;var ap_vinfo = navigator.appVersion;var ap_ver = parseFloat(ap_vinfo.substring(0,ap_vinfo.indexOf('(')));var time_start = new Date();var clock_start = time_start.getTime();var dl_ok=false;  function init () {  if(ap_name=="Netscape" && ap_ver>=3.0)  dl_ok=true;   return true;  } function get_time_spent () {   var time_now = new Date();  return((time_now.getTime() - clock_start)/1000);   } function show_secs () {   var i_total_secs = Math.round(get_time_spent());   var i_secs_spent = i_total_secs % 60;  var i_mins_spent = Math.round((i_total_secs-30)/60);   var s_secs_spent = "" + ((i_secs_spent>9) ? i_secs_spent : "0" + i_secs_spent);  var s_mins_spent ="" + ((i_mins_spent>9) ? i_mins_spent : "0" + i_mins_spent);  document.fm0.time_spent.value = s_mins_spent + ":" + s_secs_spent;  window.setTimeout('show_secs()',1000);   }// --></SCRIPT>   <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></head> <body onLoad="init(); window.setTimeout('show_secs()',1);"><br><br><center><font color=red face="隶书" size=6>检测健康程度</font></center> <br><center><table border=5 bordercolor=blue borderlight=green> <tr><td align=center height=80> <script LANGUAGE="JAVASCRIPT"> var imagenumber = 3 ; var randomnumber = Math.random() ; var rand = Math.round( (imagenumber-1) * randomnumber) + 1 ; urls = new Array; images = new Array; alts = new Array; var url = urls[rand]; var image = images[rand]; var alt = alts[rand]; function show(str){   var o =document.getElementById(str);  //o.style.display=(o.style.display=="none")?"":"none";  o.style.display=""; } function lookme(form) { var bmi;  if(! checkform(form)) return false;  comput(form);  bmi = Math.round(form.weight.value*10000/eval(form.height.value*form.height.value));  document.getElementById('bmi').innerHTML= bmi;  show("test_result");    if (bmi >40) {     document.getElementById('nowstat').innerHTML="啊,你还能买到衣服吗?\n你太、太...太胖了";  }else if (bmi >30) {     document.getElementById('nowstat').innerHTML="哇!你好胖啊!必须开始减肥了,听我的没错";  }else if (bmi >27) {     document.getElementById('nowstat').innerHTML="哎呀!你可是比较胖啊,赶快开始减肥计划吧!";  }else if (bmi >22) {     document.getElementById('nowstat').innerHTML="小心喔!稍胖,少吃点可以吗?\n还要多多运动啊!:)";   }else if (bmi >=21) {     document.getElementById('nowstat').innerHTML="我好羡慕你啊,你这可是魔鬼身材啊!! :))";  }else if (bmi >=18) {     document.getElementById('nowstat').innerHTML="瘦了一点点,你应该多吃点东西啊!";   }else if (bmi >=16) {     document.getElementById('nowstat').innerHTML="你一定是受到了虐待,快点大量吃东西吧!";  }else {     document.getElementById('nowstat').innerHTML="哇塞!前胸贴后背,你怎么像个电线杆子\n一点肉都没有,快找大夫看看吧!!";  }  return true; } function comput(form) {  if(form.sex.options.selectedIndex == "0")    document.getElementById('legendweight').innerHTML = Math.round(50+(2.3*(form.height.value-152))/2.54);  else    document.getElementById('legendweight').innerHTML = Math.round(45.5+(2.3*(form.height.value-152))/2.54); } function ClearForm(form){ form.weight.value = ""; form.height.value = ""; document.getElementById('bmi').innerHTML = ""; document.getElementById('legendweight').innerHTML = ""; 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("你以为我真的是神仙吗?你什么都不告诉我,我怎么给你测啊!!!");  ClearForm(form);    return false;   }   else if(form.weight.value <=0) {     alert("你将创下体重最轻的吉尼斯世界记录,当心地心引力对你不起作用啊.");  ClearForm(form);    return false;   }   else if(form.weight.value >500) {     alert("你不用测了,你的体重已经把我的秤压坏了.");  ClearForm(form);    return false;   }   else if(form.height.value <=0) {     alert("你不至于这么矮吧,你怎么比蚂蚁还小呢?");  ClearForm(form);    return false;   }   else if(form.height.value >=300) {     alert("喔!!!!你好伟大啊!!!!\n替我向上帝问好");  ClearForm(form);    return false;   }   return true; } </script> <form NAME="BMI" method="POST">   <table border="1" align="center" cellspacing="1">  <tr>  <td>  <table border="1" align="center" cellspacing="1">    <tr>      <td width="105"><div align="center"><font color="red">性别</font></div></td>      <td width="130"><div align="center"><font color="red">体重</font> (kg)</div></td>      <td width="192" align="center"><div align="center"><font color="red">身高</font>(cm)</div></td>      <td width="111" align="center"><div align="center"><font color="blue">健康值</font></div></td>          </tr>    <tr align="center">      <td> <Select size=1 name=***>    <Option value=0 selected>男</Option>    <Option value=1>女</Option> </Select>      </td>      <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>         </tr>    </table>    </td>    </tr>      <tr>   <td>   <table border="1" cellspacing="1">     <tr>     <td width="190" align="center"><font color="blue">您的理想体重(cm)</font></td>    <td width="356" align="center"><font color="blue">电脑对您的评价</font></td>    </tr>     <tr>     <td align="center" valign="middle"><INPUT TYPE="TEXT" onfocus=blur() size=6 name="legendweight"></td>      <td align="center" valign="middle"><input TYPE="TEXT" NAME="my_comment" size="40"></td>    </tr>    </table>    </td>    </tr>  </table>   <div align="center">  <center>  <p>  <INPUT onClick="lookme(this.form)" type="button" value="开始测试">   <INPUT type="reset" value="重新填写" >    </p>  </center>  </div></form></td></tr> <tr><td><form name="fm0" onSubmit="0"><center><font size="-1" COLOR="#888888"><I>您在本网页的停留时间:</I></font><br><INPUT type="text" name="time_spent" size=7 onFocus="this.blur()"></center></form></td></tr></table></center>   </body></html>
查看完整描述

3 回答

?
眼眸繁星

TA贡献1873条经验 获得超9个赞

呵呵,这个问题你要不能自己解决,你就不要写代码了。

基本概念:

1、getElementById(“nowstat”);//查找当前form的ID为“nowstat”的页面控件,你页面的定义全是name,有没有定义ID="nowstat'啊?

2、一般div用innerHTML,input对应的是value,你查一下页面的div

查看完整回答
反对 回复 2018-12-24
?
小唯快跑啊

TA贡献1863条经验 获得超2个赞

又不是我想写的,这也是百度来的,不是我写的
查看完整回答
反对 回复 2018-12-24
  • 3 回答
  • 0 关注
  • 580 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信