Search results for 'Document Fader'. 1 post(s) found.

  1. 2007/09/07 Document Fader
2007/09/07 13:08

Document Fader


This script allows the document to Fade between two colors. Change the color values and also the time for fading. The time can be edited at the bottom and the color could be changed for col_value.

<html>
<head>
    <title>Document Fader</title>
</head>

<body>

<script language="JavaScript" type="text/javascript">
<!-- Begin
document.bgcolor="#000000"

var hexchars="0123456789ABCDEF";
function fromHex (str) {
var high=str.charAt(0); //Note: Netscape 2.0 bug workaround


var low=str.charAt(1);
return(16*hexchars.indexOf(high))+hexchars.indexOf(low);
}

function Color(str){
    this.r=fromHex(str.substring(0,2));
    this.g=fromHex(str.substring(2,4));
    this.b=fromHex(str.substring(4,6));
    return this;
    }

// Change this value for the starting color ....
col_value="#CCCFFF";
color_start=col_value.substring(1,8);

// Change this value for the ending color ....
col_value="#FC000C";
color_end=col_value.substring(1,8);

function makearray(n) {
    this.length = n;
    for(var i = 1; i <= n; i++)
        this[i] = 0;
    return this;
}

hexa = new makearray(16);
for(var i = 0; i < 10; i++)
    hexa[i] = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";

function hex(i) {
    if (i < 0)
        return "00";
    else if (i > 255)
        return "ff";
    else
        return "" + hexa[Math.floor(i/16)] + hexa[i%16];
}

function SetBgColor(r, g, b) {
    var hr = hex(r); var hg = hex(g); var hb = hex(b);
    document.bgColor = "#"+hr+hg+hb;
}

function Fade(sr, sg, sb, er, eg, eb, step) {
    for(var i = 0; i <= step; i++) {
        SetBgColor(
        Math.floor(sr * ((step-i)/step) + er * (i/step)),
        Math.floor(sg * ((step-i)/step) + eg * (i/step)),
        Math.floor(sb * ((step-i)/step) + eb * (i/step)));
    }
}

function Fadein(val) {
    Fade(Color(color_start).r,Color(color_start).g,Color(color_start).b,Color(color_end).r,Color(color_end).g,Color(color_end).b,val);
}

/* do Fadein */
// Change the value to get the fading time.
// Higher values means slower fading
Fadein(380);

// -->
</script>

</body>
</html>

Another posts included in "HTML, Javascript"

Tooltip (0)2007/09/07
Add Message On Mouse Traling (0)2007/09/07
Number Of Vists (0)2007/09/07
Book Mark This Site (0)2007/09/07
Icon Coupled Url (0)2007/09/07
Button That Will Close The Browser Window (0)2007/09/07
Button That Will Show The Page's Source (0)2007/09/07
Add A Scrolling Status Bar Text To Your Site (0)2007/09/07
Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 04:48 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 13:47 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:38 delete

    moneyideas