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

· 18년 전 · 1792
얼마전, 어느 블로그에서 구현되었던걸 보고서 공부겸 만들어 보았습니다.
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,676
18년 전 조회 3,449
18년 전 조회 2,026
18년 전 조회 5,295
18년 전 조회 2,161
18년 전 조회 2,346
18년 전 조회 1,737
18년 전 조회 2,141
18년 전 조회 3,655
18년 전 조회 1,512
18년 전 조회 1,745
18년 전 조회 4,326
18년 전 조회 3,718
18년 전 조회 3,276
18년 전 조회 3,377
18년 전 조회 3,875
18년 전 조회 4,339
18년 전 조회 4,264
18년 전 조회 2,709
18년 전 조회 2,329
18년 전 조회 3,262
18년 전 조회 3,177
18년 전 조회 3,332
18년 전 조회 3,267
18년 전 조회 4,926
18년 전 조회 5,214
18년 전 조회 3,419
18년 전 조회 2,723
18년 전 조회 2,955
18년 전 조회 2,283
18년 전 조회 2,095
18년 전 조회 2,044
18년 전 조회 3,075
18년 전 조회 2,362
18년 전 조회 2,384
18년 전 조회 2,056
18년 전 조회 2,432
18년 전 조회 3,168
18년 전 조회 4,100
18년 전 조회 3,379
18년 전 조회 2,015
18년 전 조회 1,958
18년 전 조회 2,871
18년 전 조회 1,667
18년 전 조회 2,016
18년 전 조회 2,307
18년 전 조회 2,173
18년 전 조회 2,270
18년 전 조회 4,042
18년 전 조회 1,793
18년 전 조회 4,393
18년 전 조회 2,927
18년 전 조회 2,236
18년 전 조회 3,278
18년 전 조회 2,903
18년 전 조회 2,838
18년 전 조회 5,636
18년 전 조회 2,299
18년 전 조회 3,420
18년 전 조회 3,332
18년 전 조회 3,716
18년 전 조회 3,269
18년 전 조회 2,448
18년 전 조회 2,097
18년 전 조회 2,551
18년 전 조회 6,117
18년 전 조회 2,744
18년 전 조회 4,544
18년 전 조회 2,041
18년 전 조회 1만
18년 전 조회 2,490
18년 전 조회 1,554
18년 전 조회 2,987
18년 전 조회 2,930
18년 전 조회 2,826
18년 전 조회 2,142
18년 전 조회 2,325
18년 전 조회 2,877
18년 전 조회 2,965
18년 전 조회 4,134
18년 전 조회 6,117
18년 전 조회 2,058
18년 전 조회 2,194
18년 전 조회 1,900
18년 전 조회 1,659
18년 전 조회 2,635
18년 전 조회 1,689
18년 전 조회 1,563
18년 전 조회 4,737
18년 전 조회 1,790
18년 전 조회 1,842
18년 전 조회 1,851
18년 전 조회 1,978
18년 전 조회 3,630
18년 전 조회 1,655
18년 전 조회 1,527
18년 전 조회 1,360
18년 전 조회 1,863
18년 전 조회 1,911
18년 전 조회 3,653
🐛 버그신고