댓글 검색 목록

[javascript] 직사각형 모양을 그리는 JavaScript 프로그램을 작성하십시오.

페이지 정보

작성자 운영자 작성일 17-12-30 19:23 조회 1,338 댓글 0

HTML :

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Draw a rectangular shape</title>
</head>
<body onload="draw();">
<canvas id="canvas" width="150" height="150"></canvas>
</body>
</html>


JS :

function draw() {
  var canvas = document.getElementById('canvas');
  if (canvas.getContext) {
    var context = canvas.getContext('2d');

    context.fillRect(20,20,100,100);
    context.clearRect(40,40,60,60);
    context.strokeRect(45,45,50,50);
  }
}




댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.