·您的位置: 首页 » 资源教程 » 编程开发 » JavaScript » 68、闪烁的窗体

68、闪烁的窗体

类别: JavaScript教程  评论数:0 总得分:0
===1、将以下代码加入HTML的<HEAD></HEAD>之间:

<script LANGUAGE="JavaScript">
<!--
function toHex(dec) {
// create list of hex characters
var hexCharacters = "0123456789ABCDEF"
// if number is out of range return limit
if (dec < 0)
return "00"
if (dec > 255)
return "FF"
// decimal equivalent of first hex character in converted number
var i = Math.floor(dec / 16)
// decimal equivalent of second hex character in converted number
var j = dec % 16
// return hexadecimal equivalent
return hexCharacters.charAt(i) + hexCharacters.charAt(j)
}
// set background color to specified descriptors
function setbgColor(red, green, blue) {
document.bgColor = "#" + toHex(red) + toHex(green) + toHex(blue)
}
// fade from start to end descriptors (increase step to increase transition speed)
function fade(sred, sgreen, sblue, ered, egreen, eblue, step) {
// loop to create fade effect
for(var i = 0; i <= step; ++i) {
// set current red descriptor
var red = Math.floor(sred * ((step - i) / step) + ered * (i / step))
// set current green descriptor
var green = Math.floor(sgreen * ((step - i) / step) + egreen * (i / step))
// set current green descriptor
var blue = Math.floor(sblue * ((step - i) / step) + eblue * (i / step))
// set background color according to descriptors
setbgColor(red, green, blue)
}
}
// -->
</script>

====2、将以下代码加入HTML的<BODY></BODY>之间:

<body TEXT="red" onLoad="fade(0, 0, 0, 255, 255, 255, 64)"
onUnload="fade(255, 255, 255,0, 0, 0, 64)">
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1