free hosting   image hosting   hosting reseller   online album   e-shop   famous people 
Free Website Templates
Free Installer

Flashing Submit Button



This script from Dynamic Drive lets you create an attention-grabbing flashing submit button.


Paste the code below at the end of the body section of your page:
And this submit button script goes in the body section:

How It Works

This script works with any form element, not just a submit button.

All you have to do is give the element a flashit ID.

Each element to be flashed is assign to an array, flashelement.

The function changecolor creates the flashing effect.

The index of the flashelement array is passed to this function as which.

If the element's colour is the default, it is changed to red. And vice versa:
if (flashelement[which].style.color=='')
flashelement[which].style.color="red"
else
flashelement[which].style.color=""
The flash rate - one second in this example - is determined by:
if (flashelement.length==null)
setInterval("changecolor(0)",1000)
else
for (i=0;i<flashelement.length;i++)
{
var tempvariable='setInterval("changecolor('+i+')",'+'1000)'
eval(tempvariable)
}
A single pass is used if only one element needs to be flashed, or a loop if there are more elements.

If the latter is true, a new variable tempvariable is employed.

This provides temporary storage for the multiple setInterval commands of the loop.


Try It Out

Clicking the button will simply refresh this page:



© 2001 CyberSchool