Team:KAIST-Korea/test
From 2011.igem.org
(Difference between revisions)
Line 5: | Line 5: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
- | + | var redStart = 0xFF; | |
+ | |||
+ | var greenStart = 0x00; | ||
+ | |||
+ | var blueStart = 0x00; | ||
+ | |||
+ | var endColor = "#FFFFFF"; /* white */ | ||
+ | |||
+ | var increment = 10; | ||
+ | |||
+ | var delay = 80; | ||
+ | |||
+ | var keepRunning = true; | ||
function changeBackground(jihan) | function changeBackground(jihan) | ||
Line 22: | Line 34: | ||
} | } | ||
} | } | ||
+ | |||
+ | |||
+ | <!-- Testing 1 fade --> | ||
+ | |||
+ | function fadeBackground() { | ||
+ | |||
+ | var prefix = "#"; | ||
+ | |||
+ | var backgroundColor = prefix + getHexVal(redStart) + getHexVal(greenStart) + getHexVal(blueStart); | ||
+ | |||
+ | document.bgColor = backgroundColor; | ||
+ | |||
+ | redStart += increment; | ||
+ | |||
+ | greenStart += increment; | ||
+ | |||
+ | blueStart += increment; | ||
+ | |||
+ | if (backgroundColor == endColor) | ||
+ | |||
+ | keepRunning = false; | ||
+ | |||
+ | else | ||
+ | |||
+ | setTimeout(fadeBackground, delay); | ||
+ | |||
+ | } | ||
+ | |||
+ | <!-- Testing --> | ||
+ | |||
+ | Read more: How to make Fading Backgrounds in HTML and CSS | eHow.com http://www.ehow.com/how_5045054_make-fading-backgrounds-html-css.html#ixzz1UqHZl0pc | ||
+ | |||
Revision as of 18:54, 12 August 2011