...

View Full Version : Blinking test



abbas
12-29-2003, 03:08 AM
Hello,

I've found a script on the Net that allows me to run blinking text. However I would like to stop the blinking after 5 seconds. Can anyone offer the code that will achieve this (in this script) and where to place it. The script is as follows,

<body>
<script> var d,ctr=0; function init(){ if(document.all){d=document.all['div1'].style;} else if(document.layers){d=document.layers['div1'];} blink(); } function blink() { ctr++; if(ctr==0){d.visibility="hidden";} else{d.visibility="visible";} if(ctr>0)ctr-=2; setTimeout("blink()",1000); } </script>
<body onLoad="init()">
<div id="div1" style="position:relative; width:200; ">Searching</div>
</body>

Cheers

Abbas

Willy Duitt
12-29-2003, 03:34 AM
Try this:

<body>
<script type="text/javascript">
<!--//
var d,ctr=0;
function init(){
if(document.all){
d=document.all['div1'].style;
}
else if(document.layers){
d=document.layers['div1'];
}
blink();
}
function blink() {
ctr++;
if(ctr==0){
d.visibility="visible";
}
else{
d.visibility="hidden";
}
if(ctr>0)ctr-=2;
timer = setTimeout("blink()",1000);
setTimeout("stop()",10000);
}

function stop(){
clearTimeout(timer);
ctr=0;
}
//-->
</script>
<body onLoad="init()">
<div id="div1" style="position:relative;
width:200;
">Searching</div>
</body>

abbas
12-29-2003, 03:41 AM
Hi Willy,

Thanks for the fast reply. Appreciated. Works a treat.

Abbas

brothercake
12-29-2003, 04:26 PM
nb - the Web Content Accessibility Guidelines specifically say - do not cause text to blink. http://www.w3.org/TR/WAI-WEBCONTENT/#tech-avoid-flicker

Blinking text may trigger a seizure in someone who has photosensitive epilepsy; it's unlikely, but possible.

abbas
12-30-2003, 11:18 AM
Thanks for the advise,

There are only 5 blinks and then the (8pt) word disappears.


Abbas



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum