Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input id="input1" onkeyup="fn1()" />
- <input id="input2" />
- <input id="input3" />
- <select id="select">
- <option value="+">+</option>
- <option value="-">-</option>
- <option value="/">/</option>
- <option value="*">*</option>
- </select>
- <input type="button" onclick="sum()" value="dfsdf">
- <script>
- function fn1() {
- var input1 = document.getElementById("input1");
- var input2 = document.getElementById("input2");
- input2.value = input1.value
- }
- function sum() {
- var input1 = document.getElementById("input1");
- var input2 = document.getElementById("input2");
- var input3 = document.getElementById("input3");
- var select = document.getElementById("select");
- if(select.value == "+" )
- {
- input3.value = +input1.value + +input2.value
- }
- if(select.value == "*") {
- input3.value = +input1.value * +input2.value;
- }
- if(select.value == "/"){
- input3.value = +input1.value / +input2.value;
- }
- input3.value = calc()
- //alert(select.value)
- }
- function calc() {
- return Math.sqrt(Math.sqrt(5)) + Math.pow(10, 2);
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement