zoukankan      html  css  js  c++  java
  • 改进的面积计算

    改进的面积计算

     1 <!DOCTYPE html>
     2 <html lang="zh-cn">
     3 <head>
     4     <meta charset="utf-8">
     5     <title>7-64 课堂演示</title>
     6     <link rel="stylesheet" type="text/css" href="style.css">
     7     <style type="text/css">
     8         div{
     9             margin: 15px auto;
    10             background: orange;
    11             width: 300px;
    12             height: 240px;
    13             text-align: center;
    14             padding: 15px;
    15         }
    16         input{
    17             margin: 10px 10px;
    18             padding: 5px;
    19         }
    20     </style>
    21 </head>
    22 <body>
    23     <div>
    24         <h3>计算圆的面积</h3>
    25          <label for="radius">半径:</label>
    26          <input type="text" id="radius" ><br>
    27          <label for="area">面积:</label>
    28          <input type="text" id="area" ><br><br>
    29          <input type="button" id="js" value="计算" onclick="show()">
    30          <input type="button" id="cl" value="清空" onclick="cl()">
    31     </div>
    32     <script>
    33         function carea(r){
    34             var s=Math.PI*r*r;
    35             return s;
    36         }
    37 
    38         function show(){
    39             var radius=document.getElementById('radius').value;
    40             var area=carea(radius);
    41 
    42             document.getElementById('area').value=area
    43         }
    44 
    45         function cl(){
    46             document.getElementById('radius').value=''
    47             document.getElementById('area').value=''
    48         }
    49     </script>
    50 </body>
    51 </html>
  • 相关阅读:
    全景转换工具
    Leetcode 215.数组中的第k个最大元素
    Leetcode 214.最短回文串
    Leetcode 213.大家劫舍II
    Leetcode 212.单词搜索II
    Leetcode 211.添加与搜索单词
    Leetcode 209.长度最小的子数组
    Leetcode 208.实现前缀树
    Leetcode 207.课程表
    Leetcode 206.反转链表
  • 原文地址:https://www.cnblogs.com/Renyi-Fan/p/8093314.html
Copyright © 2011-2022 走看看