Sunday, May 1, 2011

Tip of the Day

If you want blinking text, you can use the blink element.

But the problem is, it is only supported in Firefox and Opera. So how do we fix this problem?

We use JavaScript instead. All you have to do is create an element that will contain what you want to blink in it. For example, let's use a "span" element and give it the ID "myspan". You can insert this coding into your script:

setTimeout("flash()",500);
function flash()
{
document.getElementById('myspan').style.visibility="hidden";
setTimeout("document.getElementById('myspan').style.visibility='visible'",500);
setTimeout("flash()",1000);
}

And it works! Watch this:

Blinking text

So. Just a tip. And hopefully useful. I know that the blink element is easier, but with JavaScript, you have a better advantage.

No comments:

Post a Comment

Please keep your comments appropriate.