Skip to content

Instantly share code, notes, and snippets.

@harucsx
Last active March 6, 2019 11:11
Show Gist options
  • Save harucsx/3ac7bfad3aaffc20d81e4ec2fd8ecdb7 to your computer and use it in GitHub Desktop.
Save harucsx/3ac7bfad3aaffc20d81e4ec2fd8ecdb7 to your computer and use it in GitHub Desktop.

Revisions

  1. harucsx renamed this gist Mar 6, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. harucsx revised this gist Mar 6, 2019. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions example.html
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,7 @@
    <script>
    function add(){
    var num1 = document.getElementById('num1');

    var num2 = document.getElementById('num2');

    var result = document.getElementById('result');

    var answer = parseInt(num1.value) + parseInt(num2.value);
  3. harucsx renamed this gist Mar 6, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. harucsx created this gist Mar 6, 2019.
    26 changes: 26 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <script>
    function add(){
    var num1 = document.getElementById('num1');

    var num2 = document.getElementById('num2');

    var result = document.getElementById('result');

    var answer = parseInt(num1.value) + parseInt(num2.value);

    result.innerText = answer;
    }
    </script>
    </head>
    <body>
    <input id="num1" onchange="add()"/> +
    <input id="num2" onchange="add()"/> =
    <span id="result">?</span>
    <br/>
    </body>
    </html>