완료

gabyong7의 이미지

완료

shint의 이미지

책은 반드시 보셔야 하고요.
이건 제가 경험해보니. 이런게 필요하다 싶어 적어봅니다.

<html>
<head>
</head>
 
<!-- 스타일 적용 순서는 이렇습니다. style type > html >javascript
클래스는 .으로 접근하고. div는 #으로 접근 합니다.
//-->
 
<style type="text/css">
#editor		{font-family:Arial, Tahoma,sans-serif; font-size:small background-color:#eab9b2; font-size:5px; color:white;}
.div_item	{font-family:Arial, Tahoma,sans-serif; font-size:small background-color:#eab9b2; font-size:22px; color:white;}
</style>
 
<body onkeydown="fn_keydown()">  
<div id="start" class="div_item" style='background-color:transparent; color:black; width:300; height:300; border:solid; border-width:1;
					position:absolute; left:500px; top:50px; z-index:10000;'>
	<table border="0" cellpadding="0" cellspacing="0">	<!-- table width height 를 제거 해야 div 크기로 지정 됩니다 //-->
	<tr><td>
shint
	</td></td>
	</table>
</div>
 
<!-- 스크립트는 div 하단에 있어야 하고. html에 style 코드가 있어야 적용 됩니다. //-->
<script language="javascript">
function fn_keydown()
{
	var id = document.getElementById("start");
	code = String.fromCharCode(event.keyCode);
	if(code == 'A')
	{
		id.style.left = parseInt(id.style.left) - 100;		//parseInt 꼭 해줘야 됩니다.
	}
	if(code == 'W')
	{
		id.style.top = parseInt(id.style.top) - 100;		//parseInt 꼭 해줘야 됩니다.
	}
	if(code == 'D')
	{
		id.style.left = parseInt(id.style.left) + 100;		//parseInt 꼭 해줘야 됩니다.
	}
	if(code == 'S')
	{
		id.style.top = parseInt(id.style.top) + 100;		//parseInt 꼭 해줘야 됩니다.
	}
}
document.onkeypress = fn_keydown;
</script>
 
</body>
</html>

----------------------------------------------------------------------------
젊음'은 모든것을 가능하게 만든다.

매일 1억명이 사용하는 프로그램을 함께 만들어보고 싶습니다.
정규 근로 시간을 지키는. 야근 없는 회사와 거래합니다.

각 분야별. 좋은 책'이나 사이트' 블로그' 링크 소개 받습니다. shintx@naver.com

gabyong7의 이미지

정말 큰 도움이 될 것 같습니다.
책을 보라고 하셨는데, 이런 부분도 책에 나와있나요``?
인터넷검색 결과도 신통치 않아서 고심했는데 말이져.