Source Code Program Kalkulator Javascript Multifungsi
Penulis Surya

Source Code Program Kalkulator Javascript Multifungsi

source code program kalkulator multifungsi radio button - hallo teman-teman programmer, pada kesempatan ini saya akan membagikan source code program kalkulator yang keren untuk project anda bagi mahasiswa kuliah di jurusan komputer.



<div class="box">
        <h2>Kalkulator</h2>
        <input type="text" id="number1" placeholder="number1"/><br>
        <input type="text" id="number2" placeholder="number2"/><br>
        <label><input type="radio" id="rad1" name="same" />Collection<br></label>
        <label><input type="radio" id="rad2" name="same" />Extraction<br></label>
        <label><input type="radio" id="rad3" name="same" />Multiplication<br></label>
        <label><input type="radio" id="rad4" name="same" />Division<br></label>
        <input type="button" id="but" value="calculate" />
        <div id="res"></div>
    </div>

body{
/*  www.suryapero.com  */
      margin:0;
      padding:0;
      background:#262626;
      text-transform:uppercase;
      font-family:'AR JULIAN';
      font-size:14px;
}
h2{
      font-size:28px;
      padding:0;
      margin:0;
      margin-bottom:20px;
      color:#930000;
      text-align: center;
}
.box{
      position:absolute;
      top:50%;
      left:50%;
      transform:translate(-50%,-50%);
      padding:30px;
      background:#876;
      border-radius:20px;
}
       input{
           margin:5px;
       }
       input[type="text"]{
           background:transparent;
           border:0;
           border-bottom:2px solid #930000;
           padding:7px;
           outline:none;
           font-size:17px;
       }
        input[type="button"]{
            margin-left:90px;
            padding:5px;
        }
        #res{
            background:#000000;
            color:#fff;
            font-size:16px;
            padding:4px;
        }

// www.suryapero.com
var calculate = document.getElementById("but");
        calculate.onclick = function () {
            var num1 = Number(document.getElementById("number1").value);
            var num2 = Number(document.getElementById("number2").value);
            if (document.getElementById("rad1").checked) {
                var result = num1 + num2
                document.getElementById("res").innerHTML = result;
            } else if (document.getElementById("rad2").checked) {
                var result = num1 - num2
                document.getElementById("res").innerHTML = result;
            } else if (document.getElementById("rad3").checked) {
                var result = num1 * num2
                document.getElementById("res").innerHTML = result;
            } else if (document.getElementById("rad4").checked) {
                var result = num1 / num2
                document.getElementById("res").innerHTML = result;
            }
        }

0 Response to "Source Code Program Kalkulator Javascript Multifungsi"

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2