이미지 캡쳐하기 귀찮아서 재활용한 프로폼트 화면...

 

뭇튼 숫자를 프로폼트로 받는다..... 그후 수정은 안됨...

 

사실 귀찮아서 더이상 수정안함.... 뭐 간단한 소스이니 자체적으로 수정할수 있을겁니다.

 

<script language="javascript">
var cnt = 0;
var i;
var j;

 


i = eval(prompt("첫번째 숫자입력1",""));
j = eval(prompt("두번째 숫자입력2",""));

 


/*
function input(x){
 if(cnt == 0){
  i = x;
  cnt = 1;
  form1.text1.value = i;
 } else {
  j = x;
  cnt = 0;
  form1.text1.value = i + j;
 }
}
*/


function plus(){
 total = eval(i+ "+" +j);
 form1.text1.value = i + "+" + j + "=" + total;
 alert(i + "+" + j + "=" + total);
 document.bgColor="red";
}

function minus(){
 total = eval(i+ "-" +j);
  form1.text1.value = i + "-" + j + "=" + total;
 alert(i + "-" + j + "=" + total);
  document.bgColor="blue";
}

function div(){
 total = eval(i+ "/" +j);
  form1.text1.value = i + "/" + j + "=" + total;
 alert(i + "/" + j + "=" + total);
  document.bgColor="black";
}

function muti(){
 total = eval(i+ "*" +j);
  form1.text1.value = i + "*" + j + "=" + total;
 alert(i + "*" + j + "=" + total);
  document.bgColor="yellow";
}

 

</script>
</head>
<body>
<form name="form1">
  <input type="button"  value="0" onclick="input('0')" />
  <input type="button"  value="1" onclick="input('1')" />
  <input type="button"  value="2" onclick="input('2')" />
  <input type="button"  value="3" onclick="input('3')" />
  <input type="button"  value="4" onclick="input('4')" />
  <br>
  <input type="button"  value="5" onclick="input('5')" />
  <input type="button"  value="6" onclick="input('6')" />
  <input type="button"  value="7" onclick="input('7')" />
  <input type="button"  value="8" onclick="input('8')" />
  <input type="button"  value="9" onclick="input('9')" />
  <p>
    <input type="text" name="text1"  value="" />
  <p>
    <input type="button" value="덧셈" onclick="plus()" />
    <input type="button"  value="뺄셈" onclick="minus()" />
    <input type="button"  value="나눗셈" onclick="div()" />
    <input type="button"  value="곱셈" onclick="muti()" />
</form>
</body>
</html>

 

+ Recent posts