페이지가 열리고 닫힐 때 페이드 효과 주기
본문
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function toHex(dec) {
var hexCharacters = "0123456789ABCDEF"
if (dec < 0)
return "00"
if (dec > 255)
return "FF"
var i = Math.floor(dec / 16)
var j = dec % 16
return hexCharacters.charAt(i) + hexCharacters.charAt(j)
}
function setbgColor(red, green, blue) {
document.bgColor = "#" + toHex(red) + toHex(green) + toHex(blue)
}
function fade(sred, sgreen, sblue, ered, egreen, eblue, step) {
for(var i = 0; i <= step; ++i) {
var red = Math.floor(sred * ((step - i) / step) + ered * (i / step))
var green = Math.floor(sgreen * ((step - i) / step) + egreen * (i / step))
var blue = Math.floor(sblue * ((step - i) / step) + eblue * (i / step))
setbgColor(red, green, blue)
}
}
// -->
</SCRIPT>
</HEAD>
<BODY onLoad="fade(0, 0, 0, 255, 255, 255, 64)" onUnload="fade(255, 255, 255, 0, 0, 0, 64)">
출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=105
<SCRIPT LANGUAGE="JavaScript">
<!--
function toHex(dec) {
var hexCharacters = "0123456789ABCDEF"
if (dec < 0)
return "00"
if (dec > 255)
return "FF"
var i = Math.floor(dec / 16)
var j = dec % 16
return hexCharacters.charAt(i) + hexCharacters.charAt(j)
}
function setbgColor(red, green, blue) {
document.bgColor = "#" + toHex(red) + toHex(green) + toHex(blue)
}
function fade(sred, sgreen, sblue, ered, egreen, eblue, step) {
for(var i = 0; i <= step; ++i) {
var red = Math.floor(sred * ((step - i) / step) + ered * (i / step))
var green = Math.floor(sgreen * ((step - i) / step) + egreen * (i / step))
var blue = Math.floor(sblue * ((step - i) / step) + eblue * (i / step))
setbgColor(red, green, blue)
}
}
// -->
</SCRIPT>
</HEAD>
<BODY onLoad="fade(0, 0, 0, 255, 255, 255, 64)" onUnload="fade(255, 255, 255, 0, 0, 0, 64)">
출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=105
관련링크
댓글목록
등록된 댓글이 없습니다.