473,387 Members | 1,664 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How exactly does a background fader script work???

Does a background fader work by...
A) Changing the color after a long 'loop' statement???

B) Changing the color, then waiting a bit, then changing the color
again???
To me it seems B would be less cpu/browser intensive. Does anyone know
how exactly this works and an example script? Thanks! -Nick
Jul 20 '05 #1
2 1903
Nick wrote on 18 jul 2003 in comp.lang.javascript:
Does a background fader work by...
A) Changing the color after a long 'loop' statement???

B) Changing the color, then waiting a bit, then changing the color
again???
To me it seems B would be less cpu/browser intensive. Does anyone know
how exactly this works and an example script? Thanks! -Nick


<http://www.google.com/search?q=%22background%20fader%22%22javascript%22>

249 hits

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
Well I found a good simple example script.

The setTimeout() function was the snip I guess I was looking for. Ive
seen many other scripts that just rely on a loop to change the colors
- the problem though - faster cpu, the faster colors change; not very
uniform. The setTimeout() fixes that. Here it is!!!

<script language="Javascript">
// 'i' increments the RGB values
// 't' changes the frequency of time
var t = "10";
function fader(i) {
var RGBstring = "rgb("+i+","+i+","+i+")";
document.bgColor = RGBstring;
setTimeout("fader("+(i-1)+")",t);
}
</script>

<FORM NAME="background">
<INPUT TYPE="button" VALUE="Start" onClick="fader(255)">
</FORM>
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: erik | last post by:
Is it posssible to inherit the previous pages (parent pages) background image? Is there a script out there I could look at? Thanks
2
by: zwylle | last post by:
Hi all, to avoid a nervous breakdown I finally decided to seek help :D I have a table defined with plain color background and in some cells I show pictures to frame my site. The problem I...
5
by: proximus | last post by:
Hi, I am trying to change the background of table TD's. The problem is that I have no access to the HTML code. SO I am trying to alter this using Javascript/DOM in an external .js file. I...
0
by: Mamatha | last post by:
Hi I am developing a small video capture application in C#.net. I want to develop this application like "winamp",means i want to display VUlevel meters and FADER. I want controls in .net for...
2
iam_clint
by: iam_clint | last post by:
/*###############################*/ /* Link fade script by iam_clint, bytes.com */ /* www.bytes.com, If you use this script on your site */ /* Please keep this comment at the...
1
by: sva0008 | last post by:
i have a auto suggest script that does not work in firefox , works great on IE. /******************************************************* AutoSuggest - a javascript automatic text input...
2
by: bips2008 | last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated For your convienence i have posted the code for the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.