返回列表 發帖
  1. <!DOCTYPE html>
  2. <html>
  3.         <head>
  4.                 <meta charset="UTF-8">
  5.                 <title></title>
  6.     </head>
  7.     <body>
  8.             <script type="text/javascript">
  9.              
  10.              var n=(prompt("請輸入姓名:"));
  11.               hello(n);
  12.              
  13.          function hello(name)
  14.          {
  15.                  alert(name +"你好!!");
  16.          }
  17.          alert("這是個BMI計算機");
  18.          var h=parseInt(prompt("請輸入身高:"));
  19.          var w=parseInt(prompt("請輸入體重:"));
  20.          var b=bmi(h/100,w);
  21.          alert("你的BMI是:"+b);
  22.          function bmi(height,weight)
  23.          {
  24.                  return weight/(height*height);
  25.          }
  26.             </script>
  27.     </body>
  28. </html>
複製代碼

TOP

返回列表