jQuery 기본

Programming 2009. 9. 23. 14:58 by touchsoul

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<TITLE> 나를 따라와! </TITLE>
<script type="text/javascript" src="js/jquery-1.3.2.js">
</script>
<script type="text/javascript">
$(function() {
$("<p>안녕!</p>").insertAfter("#followMe");
$("table#languages tr:nth-child(even)").css("background", "lightblue");
});

$(function(){
var result="";

$("#languages").find("td").each(function(i){
alert($(this).text());
result += $(this).text() + " ";
});

$("#result").text(result);
});
</script>
</HEAD>

<BODY>
<p id="followMe">나를 따라와!</p>
<table id="languages">
<thead>
<tr>
<td>언어</td>
<td>종류</td>
<td>연도</td>
</tr>
</thead>
<tbody>
<tr>
<td>Ruby</td>
<td>동적</td>
<td>1993</td>
</tr>
<tr>
<td>Smalltalk</td>
<td>동적</td>
<td>1972</td>
</tr>
<tr>
<td>Java</td>
<td>정적</td>
<td>1995</td>
</tr>
<tr>
<td>C++</td>
<td>정적</td>
<td>1983</td>
</tr>
</tbody>
</table>

<p><b>Hello</b>, how are you?</p>
<span id="result"></span>
</BODY>
</HTML>
Nav