Javascript
(Javascript) 자바스크립트의 반복문으로 테이블 만들기
SAFE
2016. 4. 29. 12:03
자바스크립트로 for문 돌려서 테이블을 만들 수 있다길래 만들어 보았습니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <!DOCTYPE html> <html> <head> <style> </style> </head> <body> <table width="150px" height="80px" border="1px solid red"> <tbody> <script> for (var f=1; f <10; f++){ document.write('<tr>'); document.write('<td width="150px" height="50px" style="border:1px solid red; text-align:center;">'); document.write ((f)); document.write ('</td>'); document.write ('</tr>');} </script> </tbody> </table> </body> </html> | cs |
결과
출처 : http://eproo.tistory.com/107