자바스크립트 숙제2
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<script type="text/javascript">
//<![CDATA[
//조건
//1~25까지의 숫자표를 만들어라
//가로 5개 세로 5개로 만들어라
function numTest1(){
document.write("<table cellpadding='0' cellsapcing='0' border='1' width='100%'><tr>");
for(i=1; i<=25; i++){
document.write("<td>"+i+"</td>");
if(!(i%5)){
if(i==0){
document.write("</tr>");
}else{
document.write("</tr>");
document.write("<tr>");
}
}
}
document.write("</table>");
}
numTest1();
//]]>
</script>
</head>
<body>
</body>
</html>
for(var row=1; row<=5; row++){ // 행
theTable+="<tr>";
for(var col=1; col<=7; col++){//열
theTable+="<td>1</td>"
}
theTable+="</tr>";
}