<script>

//…………………………判断用户输入的年份是否是闰年……………………………….

  function getYear(){

 

    var year=prompt(“请输入年份”);

    if((year%4==0&&yeat%100!=0)||year%400==0){

      alert(“今年是闰年”);

    }else{  

      alert(“今年不是闰年”);  

    }

  }

//…………………………………..米莱托指数………………………………………………………..

  function getWeight(){

    var height=prompt(“请您输入您的身高”);

    var weight=prompt(“请您输入您的身高”); 

    var calc=weight/(height*height);

    if(calc>25){

      alert(“偏胖”);

    }else if(calc<20){

      alert(“偏瘦”);

    }else{

      alert(“标准体重”);

    }

  }

</script>

<button onclick=”getYear()”></button>

版权声明:本文为luYing666原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/luYing666/p/10237492.html