Back to feed
Renewal·서른의 생활코딩

Sample Source 2) JavaScript Basics (Exercise 2 with jQuery 01)

NS
normalstory
cover image

js 2_5 예제2_BY jquery 01



예제 2를 요즘 잘나간다던 jquery로 구현한다면?  1




<!DOCTYPE html>


<html>


<head>


<meta charset="UTF-8"/>


<title></title>


<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>




<script type="text/javascript">


//<![CDATA[


str = "<table>";


for (i=1; i<=25; i++)


{


if(i%5==1) {


str += "<tr>";


}


str += "<td>" + i + "</td>";


if (i%5==0) {


str += "</tr>";


}


}


str += "</table>";


document.write(str);




$('table').attr("border", "1px");


$('table').attr("cellspacing", "0");


$('table').attr("cellpadding", "0");


$('table').css("border-color", "pink");


$('table').css("width", "600px");


$('table').css("height", "350px");


$('tr > td').css("text-align", "right");


$('tr > td').css("vertical-align", "top");


$('tr > td').css("padding-right", "1em");


$('tr > td').css("padding-top", "1em");


$('tr > td:last-child').css("background-color", "pink");


$('tr > td').css("font-size", "1.3em");


$('tr > td').css("font-weight", "bolder");




//]]]]>


</script>


</head>


<body>


</body>


</html>

This English version was translated by Claude.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.

More on the author's page

Keep reading

Renewal

Why You Should Use .html Instead of .md Seeing Is Believing

Jul 25, 2026·1 min
Renewal

The Most Important Thing About AX

Jul 17, 2026·2 min
Renewal

디지털 기술과 혁신에 대한 논고(지탱하는 힘)

Jul 17, 2026·5 min