Back to feed
Renewal·서른의 생활코딩

Sample Source 4) JavaScript Basic Document Structure: Window Object 3) Events and Event Handlers 3

NS
normalstory
cover image
Sample Source 4) JavaScript Basic Document Structure: Window Object 3) Events & Event Handlers 3




You've probably thought about wanting to build a calculator at least once.
Among all the examples out there, you probably know that calculator examples always make an appearance.
Why is that?
You have each digit and a way to give it a defined command.
In other words, if each of the digits 0~9 becomes a function and the symbols +-/*% mix those functions together..
you can derive very diverse results..you should be able to pull it off..
 
Anyway,
let's warm up first before building the calculator.. 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">




<head>


<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />


<title>Window Object Events & Event Handlers 3</title>




<meta name="Keywords" content="" />


<meta name="Description" content="" />




<script type="text/javascript">


//<![CDATA[




function call(form){


form.cal.value = eval(form.cal.value); // string to number


return false; // if true, it redirects to naver.


}




//]]]]]]>


</script>


</head>










<body>




<form action="http://www.naver.com" onsubmit="return call(this);" >


<input type="text" name="cal" value="20+30" /> <br />


<input type="submit" name="btn" value="Result" />


</form>




</body>




</html>


This English version was translated by Claude.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.

More on the author's page

Keep reading

Renewal

Why You Should Use .html Instead of .md Seeing Is Believing

Jul 25, 2026·1 min
Renewal

The Most Important Thing About AX

Jul 17, 2026·2 min
Renewal

디지털 기술과 혁신에 대한 논고(지탱하는 힘)

Jul 17, 2026·5 min