이미지 없이 모서리 라운드 테이블 만들어 최신글 구현

어디선가 낚시했다가 필요할것 같아 보관해 놓은 것인데 .
아마 모질라는 잘 모르겠습니다. ^^
링크 #1은 원본을 그대로 이용한 것이고
링크 #2는 최신글에 적용 시켜 보았습니다.


<HTML>
<HEAD>
<TITLE> 모서리 라운드테이블 </TITLE>
</HEAD>
<script>
function roundTable(objID) {
var obj = document.getElementById(objID);
var Parent, objTmp, Table, TBody, TR, TD;
var bdcolor, bgcolor, Space;
var trIDX, tdIDX, MAX;
var styleWidth, styleHeight;

// get parent node
Parent = obj.parentNode;
objTmp = document.createElement('SPAN');
Parent.insertBefore(objTmp, obj);
Parent.removeChild(obj);

// get attribute
bdcolor = obj.getAttribute('rborder');
bgcolor = obj.getAttribute('rbgcolor');
radius = parseInt(obj.getAttribute('radius'));
if (radius == null || radius < 1) radius = 1;
else if (radius > 6) radius = 6;

MAX = radius * 2 + 1;

/*
create table {{
*/
Table = document.createElement('TABLE');
TBody = document.createElement('TBODY');

Table.cellSpacing = 0;
Table.cellPadding = 0;

for (trIDX=0; trIDX < MAX; trIDX++) {
TR = document.createElement('TR');
TD = document.createElement('TD');

styleWidth = '1px'; styleHeight = '1px';
if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
else if (radius > 2) {
if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
}

if (styleWidth != null) TD.style.width = styleWidth;
if (styleHeight != null) TD.style.height = styleHeight;

if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
else if (tdIDX > Space && Space < MAX - tdIDX - 1) TD.style.backgroundColor = bgcolor;

if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
TR.appendChild(TD);
}
TBody.appendChild(TR);
}

/*
}}
*/

Table.appendChild(TBody);

// insert table and remove original table
Parent.insertBefore(Table, objTmp);
}
</script>

<BODY>
<table id="ta" width="300" height="150" border="0" radius="3" rborder="#999999" rbgcolor="#F8F8F8">
<tr>
<td valign="top">테스트입니다</td>
</tr>
</table>
<script>roundTable("ta");</script>

</BODY>
</HTML><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:54:41 CSS에서 이동 됨]</div>
|

댓글 11개

감사합니다.
불여우에서 잘됩니다.
링크주소 참조
멋진 팁 이군요....

꼭 써보고 싶네요...감사합니다..
라운드 테이블
blueb에서 본 스크립트네요
모질라도 잘 되는군요
너무 감사합니다^-^
이 소스는
Space = Math.abs(trIDX - parseInt(radius));
for (tdIDX=0; tdIDX < MAX; tdIDX++) {

이게 빠져서 에러납니다.

링크 참조하세요.
감사합니다!!
링크가 열리지 않습니다
댓글을 작성하시려면 로그인이 필요합니다. 로그인

프로그램

+
제목 글쓴이 날짜 조회
20년 전 조회 2,708
20년 전 조회 2,997
20년 전 조회 2,766
bbbking
20년 전 조회 5,747
20년 전 조회 2,671
bbbking
20년 전 조회 4,249
20년 전 조회 2,119
20년 전 조회 7,279
20년 전 조회 2,384
20년 전 조회 3,459
20년 전 조회 4,269
20년 전 조회 2,590
20년 전 조회 3,878
20년 전 조회 3,041
20년 전 조회 4,069
20년 전 조회 5,093
20년 전 조회 4,201
20년 전 조회 5,818
20년 전 조회 2,021
20년 전 조회 3,281
20년 전 조회 3,512
20년 전 조회 2,898
20년 전 조회 2,410
20년 전 조회 4,636
20년 전 조회 2,245
20년 전 조회 2,239
20년 전 조회 1,845
20년 전 조회 1,655
20년 전 조회 3,737
20년 전 조회 4,816
20년 전 조회 2,428
20년 전 조회 3,112
20년 전 조회 5,819
20년 전 조회 2,810
20년 전 조회 2,282
20년 전 조회 4,545
20년 전 조회 2,637
20년 전 조회 2,216
20년 전 조회 2,745
20년 전 조회 2,548
20년 전 조회 2,860
20년 전 조회 3,302
20년 전 조회 2,619
20년 전 조회 4,696
20년 전 조회 3,222
20년 전 조회 4,527
20년 전 조회 2,981
20년 전 조회 4,106
20년 전 조회 4,338
20년 전 조회 7,008
20년 전 조회 3,838
20년 전 조회 2,735
20년 전 조회 4,374
20년 전 조회 2,183
20년 전 조회 4,303
20년 전 조회 3,762
20년 전 조회 2,559
20년 전 조회 4,792
bbbking
20년 전 조회 2,503
20년 전 조회 4,487
20년 전 조회 3,542
20년 전 조회 3,559
20년 전 조회 3,800
20년 전 조회 3,182
20년 전 조회 5,897
20년 전 조회 2,921
20년 전 조회 5,825
bbbking
20년 전 조회 2,340
bbbking
20년 전 조회 1,750
bbbking
20년 전 조회 2,118
bbbking
20년 전 조회 3,508
bbbking
20년 전 조회 2,016
bbbking
20년 전 조회 4,381
20년 전 조회 3,357
bbbking
20년 전 조회 2,183
bbbking
20년 전 조회 7,779
20년 전 조회 5,523
20년 전 조회 2,968
20년 전 조회 5,551
20년 전 조회 2,339
20년 전 조회 2,566
20년 전 조회 2,334
20년 전 조회 2,188
20년 전 조회 2,105
20년 전 조회 2,572
20년 전 조회 2,541
20년 전 조회 2,435
20년 전 조회 2,645
20년 전 조회 2,343
20년 전 조회 2,547
20년 전 조회 3,481
bbbking
20년 전 조회 5,332
20년 전 조회 3,687
20년 전 조회 3,148
20년 전 조회 5,903
bbbking
20년 전 조회 5,691
20년 전 조회 4,117
20년 전 조회 2,365
20년 전 조회 3,163
20년 전 조회 1,884
🐛 버그신고