E

스타일 시트를 이용한 롤오버 버튼 메뉴 효과 나타내기

롤오버 버튼 효과를 구현하려면 2개의 이미지가 필요하지만, 스타일 시트를 이용하여 한개의 이미지로 3가지 (보통,오버,클릭) 버튼의 효과를 구현할 수 있습니다

샘플을 참고 하세요

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title> jasko sample script </title>

<!---- [1단계] 아래 코드를 <HEAD> 와 <HEAD> 태그 사이에 붙여 넣으세요 --->

<style type="text/css">
<!--

/* 배경색을 지정합니다. 이 배경색을 바꾸려면 아래 버튼(.btnout)의 색상도 같이 수정해 주어야 합니다 */
body { background:gold;}

/* 버튼 메뉴 전체의 위치와 크기를 설정 합니다 */
#btn { position:absolute; top:10px; left:10; width:150px; z-index:1;}

/* 평상시 보여지는 버튼의 모양입니다 */
.btnout {
border:gold 1px solid;
padding:2 0 0 0;
margin:2px;
}

/* 마우스를 대었을때 보여질 버튼의 보양입니다 */
.btnup {
border-top: white 1px solid;
border-right: green 1px solid;
border-bottom: green 1px solid;
border-left: white 1px solid;
padding:0 0 0 0;
margin:2px;
}

/* 마우스를 클릭 했을때 보여질 모양입니다 */
.btndown {
border-top: black 1px solid;
border-right: white 1px solid;
border-bottom: white 1px solid;
border-left: black 1px solid;
padding:0 0 0 0;
margin:2px;
}
-->
</style>

</head>

<body>

<!---- [2단계] 아래의 방법으로 <BODY> 와 <BODY> 태그 사이에 붙여 넣으세요 --->

<div id=btn>
<a href="#" target="_blank"><span id=menu0 class=btnout><img src="button.gif" border=0 alt=""></span></a><br>
<a href="#" target="_blank"><span id=menu1 class=btnout><img src="button.gif" border=0 alt=""></span></a><br>
<a href="#" target="_blank"><span id=menu2 class=btnout><img src="button.gif" border=0 alt=""></span></a><br>
<a href="#" target="_blank"><span id=menu3 class=btnout><img src="button.gif" border=0 alt=""></span></a><br>
<a href="#" target="_blank"><span id=menu4 class=btnout><img src="button.gif" border=0 alt=""></span></a><br>
<a href="#" target="_blank"><span id=menu5 class=btnout><img src="button.gif" border=0 alt=""></span></a><br>
<a href="#" target="_blank"><span id=menu6 class=btnout><img src="button.gif" border=0 alt=""></span></a><br>
<a href="#" target="_blank"><span id=menu7 class=btnout><img src="button.gif" border=0 alt=""></span></a>
</div>

<SCRIPT language=JavaScript>
<!--

menuNumber = 8; // 전체 버튼의 갯수를 적어 주세요
maxWidth = 0;

for(i=0; i < menuNumber; i++){
menu = eval('menu' + i);
maxWidth = Math.max(maxWidth, menu.innerText.length);
menu.onselectstart = function(){return false}

menu.onmouseout = function(){
this.className = 'btnout';
}

menu.onmouseover = function(){
this.className = 'btnup';
}

menu.onmouseup = function(){
this.className = 'btnup';
}

menu.onmousedown = function(){
this.className = 'btndown';
}
}

for (i=0 ; i < menuNumber ; i++){
menu = eval('menu' + i);
menu.style.pixelWidth = maxWidth * 8;
}
-->
</SCRIPT>

<!------------------------- 여기까지 ------------------------------------>


</body>
</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>

첨부파일

menu_10.zip (3.2 KB) 185회 2006-05-11 11:00
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
19년 전 조회 3,077
19년 전 조회 6,763
19년 전 조회 2,713
19년 전 조회 3,181
19년 전 조회 3,086
19년 전 조회 1,919
19년 전 조회 3,356
19년 전 조회 2,189
19년 전 조회 2,699
19년 전 조회 2,349
19년 전 조회 4,362
19년 전 조회 2,478
19년 전 조회 2,749
19년 전 조회 3,512
19년 전 조회 3,714
19년 전 조회 3,242
19년 전 조회 2,475
19년 전 조회 3,046
19년 전 조회 3,897
19년 전 조회 3,783
19년 전 조회 1,706
19년 전 조회 2,200
19년 전 조회 5,404
19년 전 조회 6,704
19년 전 조회 2,556
19년 전 조회 2,111
19년 전 조회 2,599
19년 전 조회 3,262
19년 전 조회 3,497
19년 전 조회 2,977
19년 전 조회 2,598
19년 전 조회 4,703
19년 전 조회 6,709
19년 전 조회 4,979
19년 전 조회 5,945
19년 전 조회 2,669
19년 전 조회 2,490
19년 전 조회 2,199
19년 전 조회 2,295
19년 전 조회 4,595
19년 전 조회 4,645
19년 전 조회 2,508
19년 전 조회 2,169
19년 전 조회 2,501
19년 전 조회 3,127
19년 전 조회 2,922
19년 전 조회 1,887
19년 전 조회 1,950
19년 전 조회 3,146
19년 전 조회 2,357
19년 전 조회 3,616
19년 전 조회 2,549
19년 전 조회 1,848
19년 전 조회 2,459
19년 전 조회 1,713
19년 전 조회 1,397
19년 전 조회 1,528
19년 전 조회 1,796
19년 전 조회 1,569
19년 전 조회 1,773
19년 전 조회 1,555
19년 전 조회 1,943
19년 전 조회 1,836
19년 전 조회 1,435
19년 전 조회 1,438
19년 전 조회 1,353
19년 전 조회 1,221
19년 전 조회 1,400
19년 전 조회 1,970
19년 전 조회 2,390
19년 전 조회 2,871
19년 전 조회 2,300
19년 전 조회 1,796
19년 전 조회 7,023
19년 전 조회 3,724
19년 전 조회 2,328
19년 전 조회 2,352
19년 전 조회 2,842
19년 전 조회 5,771
19년 전 조회 5,551
19년 전 조회 2,245
19년 전 조회 3,289
19년 전 조회 2,854
19년 전 조회 2,205
19년 전 조회 2,722
19년 전 조회 1,578
19년 전 조회 1,730
19년 전 조회 1,824
19년 전 조회 2,002
19년 전 조회 1,679
19년 전 조회 1,808
19년 전 조회 1,772
19년 전 조회 1,848
19년 전 조회 1,523
19년 전 조회 2,644
19년 전 조회 1,977
19년 전 조회 3,234
19년 전 조회 3,264
19년 전 조회 2,519
19년 전 조회 2,605