๐ŸŒ  ์ž๋ฐ” ์„œ๋ฒ„ ํŽ˜์ด์ง€ JSP/๐Ÿช ์ œ์ด ์ฟผ๋ฆฌ jQuery

4๏ธโƒฃ ์ œ์ด ์ฟผ๋ฆฌ - ๋ฒ„ํŠผ + 2์ฐจ์› ๋ฐฐ์—ด ์ด์šฉํ•œ ํ…Œ์ด๋ธ” ์ž๋™ ์ƒ์„ฑ

Meteora_ 2021. 3. 5. 18:26
728x90
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

<link rel="stylesheet" type="text/css" href="style.css">

</head>
<body>

	<h1>์ˆ˜์˜์‹œํ•ฉ</h1>
	
	<button type="button" id="woman">์—ฌ์„ฑ๋ถ€</button>
	<button type="button" id="man">๋‚จ์„ฑ๋ถ€</button>
<br><br>

<table border="1">

<tr>
	<th>title</th>
	<th>name</th>
	<th>time</th>
</tr>

<tr>
	<th>์šฐ์Šน</th>
	<td></td>
	<td></td>
</tr>

<tr>
	<th>2์œ„</th>
	<td></td>
	<td></td>
</tr>

<tr>
	<th>3์œ„</th>
	<td></td>
	<td></td>
</tr>

</table>


<script type="text/javascript">

//2์ฐจ์›๋ฐฐ์—ด

let woman = [["",""],["๊น€์˜ํฌ","01:06:11"],["์„ฑ์ถ˜ํ–ฅ","01:17:34"],["๋ฐ•์ง„ํฌ","01:23:45"]];

let man = [["",""],["ํ™๊ธธ๋™","01:16:23"],["์ผ์ง€๋งค","01:24:51"],["์ •์ˆ˜๋™","01:34:19"]];

$(document).ready(function(){

//$("tr:eq(1) td:eq(2)").html("๋ฐ์ดํ„ฐ");

$("#woman").click(function(){
	for(i=0; i<4; i++){
		for(j=0; j<2; j++){
			$("tr:eq(" + i + ") td:eq(" + j + ")").html(woman[i][j]);
		}
	}
});

$("#man").click(function(){
	for(i=0; i<4; i++){
		for(j=0; j<2; j++){
			$("tr:eq(" + i + ") td:eq(" + j + ")").html(man[i][j]);
		}
	}
});
	
});

</script>



</body>
</html>