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

· 18년 전 · 1935
얼마전, 어느 블로그에서 구현되었던걸 보고서 공부겸 만들어 보았습니다.
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,801
18년 전 조회 3,576
18년 전 조회 2,143
18년 전 조회 5,426
18년 전 조회 2,276
18년 전 조회 2,458
18년 전 조회 1,865
18년 전 조회 2,264
18년 전 조회 3,775
18년 전 조회 1,642
18년 전 조회 1,864
18년 전 조회 4,444
18년 전 조회 3,850
18년 전 조회 3,393
18년 전 조회 3,503
18년 전 조회 4,010
18년 전 조회 4,472
18년 전 조회 4,390
18년 전 조회 2,821
18년 전 조회 2,456
18년 전 조회 3,382
18년 전 조회 3,301
18년 전 조회 3,469
18년 전 조회 3,388
18년 전 조회 5,053
18년 전 조회 5,339
18년 전 조회 3,555
18년 전 조회 2,854
18년 전 조회 3,097
18년 전 조회 2,413
18년 전 조회 2,217
18년 전 조회 2,169
18년 전 조회 3,205
18년 전 조회 2,475
18년 전 조회 2,499
18년 전 조회 2,189
18년 전 조회 2,559
18년 전 조회 3,312
18년 전 조회 4,236
18년 전 조회 3,490
18년 전 조회 2,157
18년 전 조회 2,091
18년 전 조회 3,004
18년 전 조회 1,806
18년 전 조회 2,159
18년 전 조회 2,434
18년 전 조회 2,330
18년 전 조회 2,413
18년 전 조회 4,157
18년 전 조회 1,936
18년 전 조회 4,517
18년 전 조회 3,068
18년 전 조회 2,382
18년 전 조회 3,407
18년 전 조회 3,053
18년 전 조회 2,973
18년 전 조회 5,759
18년 전 조회 2,426
18년 전 조회 3,568
18년 전 조회 3,467
18년 전 조회 3,849
18년 전 조회 3,401
18년 전 조회 2,582
18년 전 조회 2,246
18년 전 조회 2,683
18년 전 조회 6,250
18년 전 조회 2,892
18년 전 조회 4,689
18년 전 조회 2,177
18년 전 조회 1만
18년 전 조회 2,630
18년 전 조회 1,689
18년 전 조회 3,128
18년 전 조회 3,071
18년 전 조회 2,955
18년 전 조회 2,275
18년 전 조회 2,473
18년 전 조회 3,017
18년 전 조회 3,105
18년 전 조회 4,263
18년 전 조회 6,247
18년 전 조회 2,211
18년 전 조회 2,317
18년 전 조회 2,024
18년 전 조회 1,769
18년 전 조회 2,776
18년 전 조회 1,816
18년 전 조회 1,681
18년 전 조회 4,868
18년 전 조회 1,916
18년 전 조회 1,965
18년 전 조회 1,967
18년 전 조회 2,096
18년 전 조회 3,761
18년 전 조회 1,775
18년 전 조회 1,654
18년 전 조회 1,483
18년 전 조회 1,987
18년 전 조회 2,023
18년 전 조회 3,790