본문 바로가기

개발하자/자바스크립트

1~100까지 10X10칸만들기(5의 배수표시)

 

 

<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>

'개발하자 > 자바스크립트' 카테고리의 다른 글

배열사용  (0) 2015.02.07
주석  (0) 2015.02.07
버튼색변경  (0) 2015.02.05
html onclick 이벤트  (0) 2015.02.05
rowspan,colspan  (0) 2015.02.05