천

이미지 없이 라운딩 박스 + 보더 표현하기 입니다.

· 2015-12-22 (화) 03:24:26 · 2625

<script>

function round(elm, bgcolor, border, mode) {
  var top = document.createElement('div'); top.style.cssText = 'height:5px';
  var bottom = document.createElement('div');bottom.style.cssText = 'height:5px';
  var temp = document.createElement('div'); temp.setAttribute('id', 'template');
  var border2 = (border) ? ";border-left:2px solid "+border+";border-right:2px solid "+border : "";
  var border1 = (border) ? ";border-left:1px solid "+border+";border-right:1px solid "+border : "";
  var bgcolor2 = (bgcolor) ? ";background:"+bgcolor : "";
  var bgcolor1 = (border) ? ";background:" + border : (bgcolor) ? ";background:" + bgcolor : "";

  var top_r = new Array(), bottom_r =new Array;
  var box = elm.cloneNode(true)
  for (i=1; i < 5 ;i++ )
  { top_r[i] = document.createElement('div')}

  top_r[1].style.cssText = 'margin:0px 5px;height:1px' + bgcolor1 ;
  top_r[2].style.cssText = 'margin:0px 3px;height:1px' + border2 + bgcolor2;
  top_r[3].style.cssText = 'margin:0px 2px;height:1px' + border1 + bgcolor2;
  top_r[4].style.cssText = 'margin:0px 1px;height:2px' + border1 + bgcolor2;

 
  for (i=1; i < 5 ;i++ ) {
    if (mode!='bottom') { top.appendChild(top_r[i]);temp.appendChild(top); }
    bottom_r[i] = top_r[i].cloneNode(true);
  }

  temp.appendChild(box);
  box.style.cssText =  border1 + bgcolor2;
  temp.appendChild(bottom);

  if (mode!='top') {
    for (i=4; i > 0 ;i-- ) {
      bottom.appendChild(bottom_r[i]);
    }
  }

  elm.parentNode.replaceChild(temp, elm);

}

</script>

|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
16-03-02 조회 3,218
16-01-19 조회 2,500
15-12-23 조회 2,813
15-12-08 조회 3,620
14-10-30 조회 5,669
14-06-06 조회 5,506
12-08-30 조회 3,857
12-08-20 조회 3,779
12-07-15 조회 5,109
12-07-13 조회 3,586
12-07-06 조회 3,796
12-06-27 조회 3,328
12-06-23 조회 3,524
12-05-03 조회 5,145
12-04-20 조회 4,093
12-03-29 조회 4,584
12-03-22 조회 4,665
12-03-22 조회 3,471
12-03-21 조회 3,250
12-03-11 조회 3,681
12-03-06 조회 4,220
12-02-22 조회 4,499
12-02-17 조회 3,300
12-02-17 조회 6,144
12-02-14 조회 6,068
12-02-06 조회 4,220
12-01-18 조회 3,183
12-01-06 조회 3,407
11-12-30 조회 3,874
11-12-30 조회 7,020
11-12-21 조회 3,232
11-12-21 조회 4,205
11-12-16 조회 3,241
11-12-15 조회 3,284
11-12-15 조회 3,386
11-12-15 조회 4,180
11-12-09 조회 3,202
11-12-09 조회 3,276
11-12-07 조회 2,842
11-12-07 조회 3,931
11-12-05 조회 4,382
11-12-02 조회 3,822
11-12-01 조회 2,688
11-12-01 조회 2,734
11-12-01 조회 2,717