Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- addClass
- ctrl+/
- selectedIndex
- push오류
- slideUp
- toFixed()
- 파일질라다운로드
- excel중복체크
- calc.minus
- hide
- selectoptions
- Excel
- 소스트리인증실패
- 파일질라설치
- 증가값
- FileZilla다운로드
- index %
- 주석이 먹히지 않을 때
- Math.ceil()
- removeClass
- is_check
- Git
- FileZilla설치
- 파일질라설치오류
- calc.plus
- Parent
- Math.floor()
- Math.round()
- 1521
- SUB함수
Archives
- Today
- Total
잡동사니에도 사랑을
[21.09.13] exam17 - var answer = eval(input); 본문
728x90
반응형
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function insertQuestion(){
var input = prompt("사칙연산의 수식을 입력하세요. (예: 100+50)", "")
// 문자열을 수식으로 변환시킨다
var answer = eval(input);
// 식과 결과값을
document.getElementById("question").innerHTML = input + "=" + answer
}
</script>
</head>
<body onload="insertQuestion()">
<h1 id="question"></h1>
</body>
</html>
<!--
<body onload="insertQuestion()"> : 바디 영역을 읽었을 때 javascript의 "insertQuestion()"을 부르겠다
- 그냥 글씨만 들어갈 때는 innerText. 나머지는 innerHTML.
-->
728x90
반응형
'JAVA_EE > JavaScript' 카테고리의 다른 글
[21.09.13] exam15(JavaScript) - 이벤트 처리, 종류 (0) | 2021.09.14 |
---|---|
[21.09.13] exam16 - showResult() / hideResult() / onmouseover / onmouseout (0) | 2021.09.14 |
[21.09.13] exam18 - 스파게티 소스(에러가 발생하는 이유) (0) | 2021.09.14 |
[21.09.13] exam19(JavaScript) - document.getElementById("myid") (0) | 2021.09.14 |
[21.09.10] exam13 (0) | 2021.09.10 |