HTML+CSS+JS制作一个科学计算器

可以实现基本的加减乘除,三角函数,对数,指数,阶乘,开根号,实现效果如下图:

 1.HTML代码

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
    <script src="index.js"></script>
</head>

<body>
    <div id="calculator">
        <div id="input">
            <input type="text" id="Screen" name="Screen" class="screen" value="" readonly>
        </div>
        <div id="keys">
            <input type="button" id="square" onclick="square()" value="x^2" />
            <input type="button" id="cube" onclick="cube()" value="x^3" />
            <input type="button" id="^" onclick="cal(this.id)" value="^" />
            <input type="button" id="factorial" onclick="factorial()" value="n!" />

            <input type="button" id="sin" onclick="sin()" value="sin" />
            <input type="button" id="cos" onclick="cos()" value="cos" />
            <input type="button" id="tan" onclick="tan()" value="tan" />
          
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值