개발하자/자바스크립트
1~100까지 10X10칸만들기(5의 배수표시)
i구야
2015. 2. 5. 14:31
<html>
<head>
<style type="text/css">
td{
width:60px;
height:60px;
text-align:center;
font-size:20px;
font-family:궁서;
border:3px solid pink;
}
.s1{background:yellow;
border:dotted red 4px;}
</style>
</head>
<body>
<script>
num=1;
document.write("<table>");
for(a=1;a<11;a++){
document.write("<tr>");
for(b=1;b<11;b++){
if(num%5==0){ //5의배수 표시
document.write("<td class=s1>");
}else{
document.write("<td>");
}
document.write(num++);
document.write("</td>");
}
document.write("</tr>");
}
document.write("</table>");
</script>
</body>
</html>