728x90

form 데이터를 함수에 전달해주기. document 속성 이용해서 value 값 변경해주기.

getElementById 사용 시 # 사용 안해도 됌


        function plus(form){
            var answer = parseInt(form.first.value) + parseInt(form.second.value);      
   
            document.getElementById("answer_number").value = answer;
           
        }

 

728x90

'🟢 디지털 하나路 > programming' 카테고리의 다른 글

[JavaScript] 변수  (0) 2023.05.22

+ Recent posts