<table height=372 width=544 bgcolor=0066ff> <td align=center><font size=7 color=000066 effect=shadow>WebTV BUG ! RELOAD !! </td></table>


Embedded Script Faders




So you want to make your hyperlinks blink or fade? It's very easy to accomplish with an embedded javascript. The same script can be written to fade hyperlinks, text and background colors.

Simply write, or cut and paste, one of the scripts I give you here, into a page and name it link.js . Use any name you like but you must use the js extension.

In the head section of the page to show the fade, put this tag:

<script src="link.js"></script>

 

Writing the Script

The script is very simple:
Begin by telling the browser how to 'see' your array.

 
function MakeArray(n) { 
this.length = n 
for (i = 0;i<n;i++) 
   this[i] = null 
} 

Next, define the array of 3 objects (color3 in this example) and define a counter (g) and a qualifier (a). Any number of objects can be used; however, the larger value for "g" in the conditional statemnt must be one greater than the highest object number.

 
color3 = new MakeArray(3) 
g = 0 
a = true 
color3[1] = "#ffff00" 
color3[2] = "#ffff99" 
color3[3] = "#ff6600" 
} 

Next, make a function (ffade) to use the objects in the array. The values of "g" and "a" are changing according to the conditional statements. g++ means add 1 to "g", and g-- means to subtract one.

 
function ffade() { 
if(a == true) { 
g++ 
} 
if(g==4) { 
g-- 
a = false 
} 
if(g==1) { 
g++ 
a = true 
} 
if(a == false) { 
g-- 
} 

Define what you want color3[g] to be; in this case, it is fgcolor or the color of your text. This script also works for for bgColor and linkColor.
The timeout value is the number of milliseconds delay between each execution of the script.

 
document.fgColor = color3[g] 
setTimeout ("ffade()",1000) 
} 

Call up the function:

ffade(); 

 

To see the scripts in action and access C&P:

Demo of all 3 at once.
Fading hyperlinks.
Fading background.
Fading Text.

Bodacious Test Bed

HOME ][ jawjahboy.com

Copyright © 2000 T. R. Landrum. All rights reserved.