SHARE
TWEET

Untitled

a guest May 21st, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <input id="input1" onkeyup="fn1()" />
  2.   <input id="input2" />
  3.   <input id="input3" />
  4.   <select id="select">
  5.     <option value="+">+</option>
  6.     <option value="-">-</option>
  7.     <option value="/">/</option>
  8.     <option value="*">*</option>
  9.   </select>
  10.   <input type="button" onclick="sum()" value="dfsdf">
  11.  
  12. <script>
  13. function fn1() {
  14.   var input1 = document.getElementById("input1");
  15.   var input2 = document.getElementById("input2");
  16.  
  17.   input2.value = input1.value
  18. }  
  19.  
  20. function sum() {
  21. var input1 = document.getElementById("input1");
  22.   var input2 = document.getElementById("input2");
  23.   var input3 = document.getElementById("input3");
  24.   var select = document.getElementById("select");
  25.  
  26.   if(select.value == "+" )
  27.   {
  28.     input3.value = +input1.value + +input2.value
  29.   }
  30.  
  31.  
  32.   if(select.value == "*") {
  33.     input3.value = +input1.value * +input2.value;
  34.   }
  35.  if(select.value == "/"){
  36.    input3.value = +input1.value / +input2.value;
  37.  }
  38.  
  39.   input3.value = calc()
  40.  
  41.  
  42.   //alert(select.value)
  43.  
  44. }
  45.  
  46. function calc() {
  47.   return Math.sqrt(Math.sqrt(5)) + Math.pow(10, 2);
  48. }
  49.  
  50.  
  51. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top