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

· 18년 전 · 1776
얼마전, 어느 블로그에서 구현되었던걸 보고서 공부겸 만들어 보았습니다.
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,661
18년 전 조회 3,438
18년 전 조회 2,013
18년 전 조회 5,283
18년 전 조회 2,145
18년 전 조회 2,329
18년 전 조회 1,724
18년 전 조회 2,131
18년 전 조회 3,644
18년 전 조회 1,497
18년 전 조회 1,731
18년 전 조회 4,313
18년 전 조회 3,704
18년 전 조회 3,263
18년 전 조회 3,362
18년 전 조회 3,864
18년 전 조회 4,324
18년 전 조회 4,251
18년 전 조회 2,701
18년 전 조회 2,315
18년 전 조회 3,249
18년 전 조회 3,162
18년 전 조회 3,317
18년 전 조회 3,253
18년 전 조회 4,909
18년 전 조회 5,202
18년 전 조회 3,402
18년 전 조회 2,710
18년 전 조회 2,942
18년 전 조회 2,269
18년 전 조회 2,078
18년 전 조회 2,030
18년 전 조회 3,062
18년 전 조회 2,348
18년 전 조회 2,369
18년 전 조회 2,042
18년 전 조회 2,419
18년 전 조회 3,152
18년 전 조회 4,085
18년 전 조회 3,367
18년 전 조회 2,000
18년 전 조회 1,942
18년 전 조회 2,857
18년 전 조회 1,649
18년 전 조회 2,001
18년 전 조회 2,291
18년 전 조회 2,155
18년 전 조회 2,258
18년 전 조회 4,030
18년 전 조회 1,777
18년 전 조회 4,381
18년 전 조회 2,912
18년 전 조회 2,218
18년 전 조회 3,264
18년 전 조회 2,891
18년 전 조회 2,826
18년 전 조회 5,621
18년 전 조회 2,286
18년 전 조회 3,406
18년 전 조회 3,316
18년 전 조회 3,699
18년 전 조회 3,256
18년 전 조회 2,433
18년 전 조회 2,084
18년 전 조회 2,534
18년 전 조회 6,102
18년 전 조회 2,726
18년 전 조회 4,528
18년 전 조회 2,026
18년 전 조회 1만
18년 전 조회 2,473
18년 전 조회 1,539
18년 전 조회 2,976
18년 전 조회 2,918
18년 전 조회 2,816
18년 전 조회 2,128
18년 전 조회 2,307
18년 전 조회 2,859
18년 전 조회 2,952
18년 전 조회 4,117
18년 전 조회 6,107
18년 전 조회 2,042
18년 전 조회 2,175
18년 전 조회 1,886
18년 전 조회 1,644
18년 전 조회 2,621
18년 전 조회 1,680
18년 전 조회 1,548
18년 전 조회 4,727
18년 전 조회 1,777
18년 전 조회 1,828
18년 전 조회 1,836
18년 전 조회 1,963
18년 전 조회 3,618
18년 전 조회 1,642
18년 전 조회 1,517
18년 전 조회 1,346
18년 전 조회 1,851
18년 전 조회 1,896
18년 전 조회 3,642
🐛 버그신고