Created
July 25, 2018 08:02
-
-
Save Oraindrop/b074c29b8e99c8c3760411658ba6c519 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body onload = main()> | |
<script> | |
var printRec = function(str,i,j){ | |
if(i === 0 || i === Number(str[1]-1)){ | |
document.write("<div id= \"div\" style=\"position : absolute\; left:" + (j*10) + "px\; top:" + i*10 + "px\;\">*</div>"); | |
} | |
else{ | |
if(j===0 || j ===Number(str[0])-1){ | |
document.write("<div id= \"div\" style=\"position : absolute\; left:" + (j*10) + "px\; top:" + i*10 + "px\;\">*</div>"); | |
} | |
} | |
} | |
var main = function(){ | |
var input = prompt("직사각형의 밑변(n)과 높이(m)를 n,m 형식으로 입력해주세요."); | |
var str = []; | |
str = input.split(","); | |
for(var i = 0; i < Number(str[1]); i++){ | |
for(var j = 0; j<Number(str[0]); j++){ | |
printRec(str,i,j); | |
} | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment