{"id":1418,"date":"2005-04-07T04:52:51","date_gmt":"2005-04-07T04:52:51","guid":{"rendered":"http:\/\/dev.jblove.net\/?p=1418"},"modified":"2005-04-07T04:52:51","modified_gmt":"2005-04-07T04:52:51","slug":"%eb%9e%9c%eb%8d%a4%ec%b6%9c%eb%a0%a5-tr-%ed%96%89%ec%97%90-%ec%82%ac%ec%9a%a9","status":"publish","type":"post","link":"https:\/\/jblove.net\/?p=1418","title":{"rendered":"\ub79c\ub364\ucd9c\ub825 tr \ud589\uc5d0 \uc0ac\uc6a9"},"content":{"rendered":"<p><!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"><br \/>\n<html><br \/>\n<head><br \/>\n<title>\ub79c\ub364 \ucd9c\ub825<\/title><\/p>\n<style type=\"text\/css\">\nTBODY.RandomContainer TR.RandomItem { display: none }<br \/>\n<\/style>\n<p>\n<script language=\"Javascript\"><\/p>\n<p>\/**<br \/>\n\ub79c\ub364 \ucd9c\ub825 \uc801\uc6a9\ud568\uc218<br \/>\n\ud398\uc774\uc9c0\ub0b4\uc758 \ubaa8\ub4e0 TBODY.RandomContainer \ub97c \ucc3e\uc544\uc11c \ub79c\ub364 \uc124\uc815\uc744 \uc801\uc6a9\ud55c\ub2e4.<br \/>\n*\/<br \/>\nfunction ShowRandomItem()<br \/>\n{<br \/>\n\tvar containers = document.getElementsByTagName('TBODY');<br \/>\n\tfor (var i = 0; i < containers.length; i++)<br \/>\n\t{<br \/>\n\t\tif (containers.item(i).className != 'RandomContainer')<br \/>\n\t\t\tcontinue;<\/p>\n<p>\t\tvar container = containers.item(i);<br \/>\n\t\tvar count = 0;<br \/>\n\t\tif (container.id.match(\/:([0-9]+)$\/))<br \/>\n\t\t\tcount = Number(RegExp.$1);<br \/>\n\t\telse<br \/>\n\t\t\tcount = 1;<\/p>\n<p>\t\tvar rows = container.childNodes;<br \/>\n\t\tvar item_list = new Array(), item_count = 0;<br \/>\n\t\tfor (var j = 0; j < rows.length; j++)<br \/>\n\t\t{<br \/>\n\t\t\tvar row = rows.item(j);<br \/>\n\t\t\tif (row.tagName != 'TR' || row.className != 'RandomItem' || row.id == null || row.id == '')<br \/>\n\t\t\t\tcontinue;<\/p>\n<p>\t\t\tif (row.id.match(\/:([0-9]+)$\/)) {<br \/>\n\t\t\t\tvar weight = Number(RegExp.$1);<br \/>\n\t\t\t\tif (weight > 0) {\t\/\/ \uac00\uc911\uce58\uac00 0\uc774\uba74 \ud3ec\ud568\uc2dc\ud0a4\uc9c0 \uc54a\ub294\ub2e4.<br \/>\n\t\t\t\t\titem_count++;<br \/>\n\t\t\t\t\tfor (var k = 0; k < weight; k++)<br \/>\n\t\t\t\t\t\titem_list[item_list.length] = row.id;<br \/>\n\t\t\t\t}<br \/>\n\t\t\t}<br \/>\n\t\t\telse { \/\/ \uac00\uc911\uce58\ub97c \ud310\ub2e8\ud560 \uc218 \uc5c6\uc73c\uba74 1\ub85c \uac04\uc8fc<br \/>\n\t\t\t\titem_list[item_list.length] = row.id;<br \/>\n\t\t\t\titem_count++;<br \/>\n\t\t\t}<br \/>\n\t\t}<\/p>\n<p>\t\t\/\/ \ub79c\ub364 \ud45c\uc2dc \uc124\uc815\uc744 \uc801\uc6a9\ud55c\ub2e4.<br \/>\n\t\tvar show_count = 0;<br \/>\n\t\twhile (show_count < count &#038;&#038; show_count < item_count)<br \/>\n\t\t{<br \/>\n\t\t\tvar rand = Math.random();<br \/>\n\t\t\tvar index = Math.floor(rand * 1000) % item_list.length;<br \/>\n\t\t\tvar id = item_list[index];<br \/>\n\/\/debug('index: ' + index + ', id: ' + id);<br \/>\n\t\t\tvar row = document.getElementById(id);<br \/>\n\t\t\tif (row != null) {<br \/>\n\/\/debug('found_row: ' + row.id);<br \/>\n\t\t\t\t\/\/ \ud45c\uc2dc\ud558\ub294 \ubc29\ubc95\uc740 tr \uac1c\uccb4\ub97c \ubcf5\uc0ac\ud574\uc11c \ub2e4\uc2dc tbody\uc5d0 \ucd94\uac00\ud558\ub294 \ubc29\uc2dd<br \/>\n\t\t\t\tvar cloned = row.cloneNode(true);<br \/>\n\t\t\t\tcloned.className = '';<br \/>\n\t\t\t\tcloned.id = '';<br \/>\n\t\t\t\tcontainer.appendChild(cloned);<br \/>\n\t\t\t\tshow_count++;<br \/>\n\t\t\t\t\/\/ \uc911\ubcf5 \uc120\ud0dd\ub418\ub294 \uac83\uc744 \ub9c9\uae30 \uc704\ud574 \ud55c\ubc88 \ud45c\uc2dc\ub41c \ud589\uc740 \uc81c\uac70\ud574\ubc84\ub9b0\ub2e4.<br \/>\n\t\t\t\tcontainer.removeChild(row);<br \/>\n\t\t\t}<br \/>\n\t\t}<\/p>\n<p>\t\t\/\/ \ub4b7\ucc98\ub9ac \ud45c\uc2dc\ub418\uc9c0 \uc54a\ub294 RandomItem \ud074\ub798\uc2a4\uc758 \ubaa8\ub4e0 \ud589\uc744 \uc81c\uac70<br \/>\n\t\tfor (var j = rows.length - 1; j >= 0; j--) {<br \/>\n\t\t\tvar row = rows.item(j);<br \/>\n\t\t\tif (row.tagName == 'TR' && row.className == 'RandomItem')<br \/>\n\t\t\t\tcontainer.removeChild(row);<br \/>\n\t\t}<br \/>\n\t}<br \/>\n}<\/p>\n<p>\/\/ \ub514\ubc84\uadf8\uc6a9 \ucd9c\ub825\ud568\uc218<br \/>\nfunction debug(message)<br \/>\n{<br \/>\n\tvar debug_out = document.getElementById('debug_out');<br \/>\n\tif (message == null)<br \/>\n\t\tdebug_out.value = '';<br \/>\n\telse<br \/>\n\t\tdebug_out.value += message + \"<br \/>\n\";<br \/>\n}<\/p>\n<p>function document_load()<br \/>\n{<br \/>\n\tdebug();\t\/\/ \ub514\ubc84\uadf8 \ucd9c\ub825 \ucd08\uae30\ud654<br \/>\n\tShowRandomItem();<br \/>\n\tdebug(document.getElementById('eventlist:2').innerHTML);<br \/>\n}<\/p>\n<p><\/script><br \/>\n<\/head><\/p>\n<p><body onload=\"document_load()\"><\/p>\n<table border=\"1\" cellspacing=\"1\" cellpadding=\"5\"><\/p>\n<tr><\/p>\n<td>\ud5e4\ub354<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tbody class=\"RandomContainer\" id=\"eventlist:2\"><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_0:1\"><\/p>\n<td>0\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_1:1\"><\/p>\n<td>1\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_2:1\"><\/p>\n<td>2\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_3:1\"><\/p>\n<td>3\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_4:10\"><\/p>\n<td>4\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_5:1\"><\/p>\n<td>5\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_6:1\"><\/p>\n<td>6\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_7:2\"><\/p>\n<td>7\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_8:5\"><\/p>\n<td>8\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p><\/p>\n<tr class=\"RandomItem\" id=\"eventlist_9:1\"><\/p>\n<td>9\ubc88 \ub0b4\uc6a9<\/td>\n<p>\n<\/tr>\n<p>\n<\/tbody>\n<p><\/p>\n<tr><\/p>\n<td>\ud478\ud130<\/td>\n<p>\n<\/tr>\n<p>\n<\/table>\n<p>\n \uc0c8\ub85c\uace0\uce68 \ud558\ub294 \uac70\ub2e4.<\/p>\n<p><textarea id=\"debug_out\" style=\"width: 100%; height: 300px\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub79c\ub364 \ucd9c\ub825 \ud5e4\ub354 0\ubc88 \ub0b4\uc6a9 1\ubc88 \ub0b4\uc6a9 2\ubc88 \ub0b4\uc6a9 3\ubc88 \ub0b4\uc6a9 4\ubc88 \ub0b4\uc6a9 5\ubc88 \ub0b4\uc6a9 6\ubc88 \ub0b4\uc6a9 7\ubc88 \ub0b4\uc6a9 8\ubc88 \ub0b4\uc6a9 9\ubc88 \ub0b4\uc6a9 \ud478\ud130 \uc0c8\ub85c\uace0\uce68 \ud558\ub294 \uac70\ub2e4.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[51],"tags":[],"class_list":["post-1418","post","type-post","status-publish","format-standard","hentry","category-papa-php"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts\/1418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1418"}],"version-history":[{"count":0,"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts\/1418\/revisions"}],"wp:attachment":[{"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}