views:

106

answers:

4

I am in need a link that will flash every 500 milleseconds, for a duration of 5 seconds... I remember long ago having a link like this, but deleted it because one could only click it when it was visible. Is there a workaround for that?

+1  A: 

There is a JavaScript function in Script.aculo.us to do that : Have a look on Effect.Pulsate

Cicatrice
Could I recommend some strobe lights and a nice drum-n-bass beat to go with that text effect?
Lèse majesté
*unce unce unce unce unce*
espais
+1  A: 

Try this:

<script type="text/javascript">
var col = new String();
var x=1;var y;

function blink()
{
 if(x%2) 
 {
  col = "rgb(255,0,0)";
 }else{
  col = "rgb(255,255,255)";
 }

 aF.style.color=col;x++;if(x>2){x=1};setTimeout("blink()",500);
}
</script>


<body onload="blink()">

<a id="aF" href="http://www.google.com"&gt;&lt;b&gt;*Google!*&lt;/b&gt;&lt;br&gt;
Sarfraz
Thank you! that at least solved the problem i had previously where i could not click the link when the text was hidden :)
David
@David: You are welcome...
Sarfraz
added setTimeout("stopblink()",5000); to the bottom of your script... In stopblink() i simply changed the id aF and now it works as intended... Thanks again
David
+1  A: 

There is CSS

text-decoration: blink

but that will blink your link all the time, you would need some javascript to change the style after 5 seconds.

Redlab
Yes, that is probably the best way to do it, but unfortunately, blink isn't supported by IE, Safari, or Chrome: http://www.w3schools.com/Css/pr_text_text-decoration.asp . It's part of CSS2, and browsers are supposed to support it, but add the option of disabling it to conform to WAI UAAG: http://www.w3.org/TR/UAAG/guidelines.html#tech-on-off-blinking-text
Lèse majesté
A: 

Remember to always keep usability for all users in mind. Especially if you're making something flash at a certain frequency. Just be careful.

sigint