[스크립트] 이미지 없는 둥글게 테두리 DIV
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>이미지 없이 라운딩 박스 + 보더 표현하기!</title>
<style>
* {font-size:12px;}
#test {padding:3px;}
</style>
</head>
<body>
<div id='test'>이미지 없이 라운딩 박스 + 보더 표현하기!</div>
<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>
<p>
<a href="#" onclick="round(document.getElementById('test'),'#f0f0f0','#c0c0c0')">배경+테두리</a> <br />
<a href="#" onclick="round(document.getElementById('test'),'#eeeeee')">배경만</a> <br />
<a href="javascript:window.location.reload()">원상태로</a> <br />
</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>이미지 없이 라운딩 박스 + 보더 표현하기!</title>
<style>
* {font-size:12px;}
#test {padding:3px;}
</style>
</head>
<body>
<div id='test'>이미지 없이 라운딩 박스 + 보더 표현하기!</div>
<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>
<p>
<a href="#" onclick="round(document.getElementById('test'),'#f0f0f0','#c0c0c0')">배경+테두리</a> <br />
<a href="#" onclick="round(document.getElementById('test'),'#eeeeee')">배경만</a> <br />
<a href="javascript:window.location.reload()">원상태로</a> <br />
</p>
</body>
</html>
[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 330 |
prosper
|
20년 전 | 2240 | |
| 329 |
prosper
|
20년 전 | 1849 | |
| 328 |
prosper
|
20년 전 | 1660 | |
| 327 | 20년 전 | 3740 | ||
| 326 | 20년 전 | 4816 | ||
| 325 |
hwatta
|
20년 전 | 2435 | |
| 324 |
|
20년 전 | 3119 | |
| 323 | 20년 전 | 5824 | ||
| 322 |
hwatta
|
20년 전 | 2816 | |
| 321 |
hwatta
|
20년 전 | 2295 | |
| 320 |
yesmoa
|
20년 전 | 4548 | |
| 319 | 20년 전 | 2648 | ||
| 318 | 20년 전 | 2222 | ||
| 317 |
kyodon
|
20년 전 | 2750 | |
| 316 | 20년 전 | 2551 | ||
| 315 |
|
20년 전 | 2868 | |
| 314 |
|
20년 전 | 3307 | |
| 313 |
|
20년 전 | 2624 | |
| 312 |
yesmoa
|
20년 전 | 4697 | |
| 311 | 20년 전 | 3225 | ||
| 310 |
홀로남은자
|
20년 전 | 4536 | |
| 309 | 20년 전 | 2991 | ||
| 308 | 20년 전 | 4105 | ||
| 307 | 20년 전 | 4339 | ||
| 306 | 20년 전 | 7009 | ||
| 305 | 20년 전 | 3842 | ||
| 304 | 20년 전 | 2742 | ||
| 303 |
크리스탈처럼
|
20년 전 | 4375 | |
| 302 | 20년 전 | 2188 | ||
| 301 |
|
20년 전 | 4310 | |
| 300 | 20년 전 | 3765 | ||
| 299 | 20년 전 | 2565 | ||
| 298 | 20년 전 | 4791 | ||
| 297 |
|
20년 전 | 2505 | |
| 296 | 20년 전 | 4498 | ||
| 295 | 20년 전 | 3551 | ||
| 294 | 20년 전 | 3569 | ||
| 293 | 20년 전 | 3803 | ||
| 292 | 20년 전 | 3185 | ||
| 291 |
yesmoa
|
20년 전 | 5900 | |
| 290 | 20년 전 | 2919 | ||
| 289 | 20년 전 | 5826 | ||
| 288 |
|
20년 전 | 2350 | |
| 287 |
|
20년 전 | 1758 | |
| 286 |
|
20년 전 | 2124 | |
| 285 |
|
20년 전 | 3516 | |
| 284 |
|
20년 전 | 2016 | |
| 283 |
|
20년 전 | 4383 | |
| 282 | 20년 전 | 3361 | ||
| 281 |
|
20년 전 | 2187 | |
| 280 |
|
20년 전 | 7782 | |
| 279 | 20년 전 | 5522 | ||
| 278 | 20년 전 | 2972 | ||
| 277 |
|
20년 전 | 5553 | |
| 276 | 20년 전 | 2340 | ||
| 275 | 20년 전 | 2577 | ||
| 274 | 20년 전 | 2341 | ||
| 273 | 20년 전 | 2190 | ||
| 272 | 20년 전 | 2112 | ||
| 271 | 20년 전 | 2583 | ||
| 270 | 20년 전 | 2568 | ||
| 269 | 20년 전 | 2448 | ||
| 268 | 20년 전 | 2663 | ||
| 267 | 20년 전 | 2348 | ||
| 266 | 20년 전 | 2551 | ||
| 265 | 20년 전 | 3482 | ||
| 264 |
|
20년 전 | 5337 | |
| 263 |
|
20년 전 | 3697 | |
| 262 | 20년 전 | 3151 | ||
| 261 |
허저비
|
20년 전 | 5906 | |
| 260 |
|
20년 전 | 5699 | |
| 259 | 20년 전 | 4117 | ||
| 258 | 20년 전 | 2365 | ||
| 257 | 20년 전 | 3165 | ||
| 256 | 20년 전 | 1883 | ||
| 255 | 20년 전 | 1547 | ||
| 254 | 20년 전 | 3122 | ||
| 253 | 20년 전 | 3534 | ||
| 252 | 20년 전 | 5082 | ||
| 251 | 20년 전 | 5792 | ||
| 250 | 20년 전 | 3654 | ||
| 249 | 20년 전 | 4991 | ||
| 248 | 20년 전 | 3271 | ||
| 247 | 20년 전 | 3616 | ||
| 246 |
|
20년 전 | 7924 | |
| 245 |
|
20년 전 | 5886 | |
| 244 | 20년 전 | 4467 | ||
| 243 |
|
20년 전 | 4021 | |
| 242 | 20년 전 | 2750 | ||
| 241 | 20년 전 | 2692 | ||
| 240 | 20년 전 | 2324 | ||
| 239 | 20년 전 | 1627 | ||
| 238 |
아우겐나이스
|
20년 전 | 2239 | |
| 237 |
email
|
20년 전 | 3660 | |
| 236 | 20년 전 | 4122 | ||
| 235 | 20년 전 | 10442 | ||
| 234 | 20년 전 | 5039 | ||
| 233 | 20년 전 | 3353 | ||
| 232 | 20년 전 | 3176 | ||
| 231 | 20년 전 | 3808 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기