글씨의 색을 자동으로 변환시켜주는 함수

· 18년 전 · 1789
얼마전, 어느 블로그에서 구현되었던걸 보고서 공부겸 만들어 보았습니다.
onMouseover 와 onMouseout에 this객체만 넣어주시면 됩니다.
많은 태클과 개선점 제시해 주시면 감사하겠습니다.
----------------------------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Untitled</title>
<style type="text/css">
.hym{
color:black;
font-weight:400;
margin:10px 0px 10px 0px;
cursor:help;
width:140px;
height:25px;
padding:3px;
border:1px solid red;
background-color:lightyellow;
}
</style>
<script language="javascript">
var colorArray = ["#cedfff","#b0acff","#ee311c","#8e60dd","#c875b5","#de8faf","#25dc8e","#61e274","#becb21","#dd7ce4"];
var display;
var colorNum = 0;

function setColor(aObj){
    temp = 'setInterval(function(){ showColor(aObj); },60)';
    display = eval(temp);
}

function showColor(aObj){    
    colorNum = colorNum == colorArray.length -1 ? 0:colorNum+=1;    
    aObj.style.color=colorArray[colorNum];    
    aObj.style.fontWeight = 700;
}

function BreakColor(aObj){
    clearInterval(display);
    aObj.style.fontWeight = 400;
    aObj.style.color="black";
}
</script>
</head>

<body>
<div class="hym" onMouseover="setColor(this);" onMouseout="BreakColor(this);">Change Color..</div>
<div class="hym" onMouseover="setColor(this);" onMouseout="BreakColor(this);">Style Color...</div>
<div class="hym" onMouseover="setColor(this);" onMouseout="BreakColor(this);">Bye Bye Bye...</div>
</body>
</html>
[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
18년 전 조회 1,675
18년 전 조회 3,448
18년 전 조회 2,026
18년 전 조회 5,295
18년 전 조회 2,155
18년 전 조회 2,341
18년 전 조회 1,734
18년 전 조회 2,140
18년 전 조회 3,654
18년 전 조회 1,508
18년 전 조회 1,741
18년 전 조회 4,323
18년 전 조회 3,715
18년 전 조회 3,273
18년 전 조회 3,376
18년 전 조회 3,873
18년 전 조회 4,335
18년 전 조회 4,261
18년 전 조회 2,708
18년 전 조회 2,327
18년 전 조회 3,261
18년 전 조회 3,171
18년 전 조회 3,329
18년 전 조회 3,263
18년 전 조회 4,923
18년 전 조회 5,211
18년 전 조회 3,416
18년 전 조회 2,719
18년 전 조회 2,953
18년 전 조회 2,281
18년 전 조회 2,091
18년 전 조회 2,039
18년 전 조회 3,073
18년 전 조회 2,361
18년 전 조회 2,382
18년 전 조회 2,053
18년 전 조회 2,430
18년 전 조회 3,162
18년 전 조회 4,095
18년 전 조회 3,377
18년 전 조회 2,012
18년 전 조회 1,954
18년 전 조회 2,867
18년 전 조회 1,664
18년 전 조회 2,011
18년 전 조회 2,304
18년 전 조회 2,167
18년 전 조회 2,269
18년 전 조회 4,038
18년 전 조회 1,790
18년 전 조회 4,389
18년 전 조회 2,924
18년 전 조회 2,232
18년 전 조회 3,274
18년 전 조회 2,899
18년 전 조회 2,836
18년 전 조회 5,630
18년 전 조회 2,296
18년 전 조회 3,418
18년 전 조회 3,325
18년 전 조회 3,713
18년 전 조회 3,267
18년 전 조회 2,446
18년 전 조회 2,095
18년 전 조회 2,546
18년 전 조회 6,114
18년 전 조회 2,737
18년 전 조회 4,542
18년 전 조회 2,039
18년 전 조회 1만
18년 전 조회 2,486
18년 전 조회 1,551
18년 전 조회 2,986
18년 전 조회 2,927
18년 전 조회 2,824
18년 전 조회 2,140
18년 전 조회 2,319
18년 전 조회 2,872
18년 전 조회 2,964
18년 전 조회 4,130
18년 전 조회 6,117
18년 전 조회 2,056
18년 전 조회 2,189
18년 전 조회 1,896
18년 전 조회 1,658
18년 전 조회 2,632
18년 전 조회 1,688
18년 전 조회 1,560
18년 전 조회 4,736
18년 전 조회 1,788
18년 전 조회 1,842
18년 전 조회 1,849
18년 전 조회 1,975
18년 전 조회 3,628
18년 전 조회 1,652
18년 전 조회 1,524
18년 전 조회 1,357
18년 전 조회 1,859
18년 전 조회 1,908
18년 전 조회 3,651
🐛 버그신고