본문 바로가기

카테고리 없음

[Script 이론 코드] 전화요금(초) & 배경색 변경

<body>


<form name="form1">

전화하는 시간은

<input type="text" size="10" name="formSec">

입니다<br>

전화요금은

<input type="text" size="10" name="formWon">

입니다

</form>


<button onclick="document.bgColor='#ffff00'">배경색 변경</button>

ba<bgsoundColor>

<script type="text/javascript">


var myCnt = 1;


function func() {

document.form1.formSec.value = myCnt + "초";

document.form1.formWon.value = ((Math.floor(myCnt/5) * 10) + 10 ) + "원";

myCnt = myCnt + 1;

}


setInterval("func()", 100);


</script>





<실행>