Forum Moderators: open

Message Too Old, No Replies

How to make HTML text flashing?

         

irock

8:41 am on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tried <BLINK> tags with no success on IE6. Netscape 7 seem to work fine though. Does anyone know how to make this possible?

Thanks!

hartlandcat

9:36 am on Sep 7, 2003 (gmt 0)

10+ Year Member



<blink> has never been supported in IE, and most likely never will. Traditionally, IE supported <marquee> but not <blink>, but Netscape supported <blink> but not <marquee>. Support for <marquee> was added fairly recently (most likely at version 6.0) because many top Chinese websites use it excessively, and are thus unreadable without it. Opera has never supported either.

While it is possible to get IE to blink text using JavaScript, blinking text (and marquees) are generally deemed anoying. Many Netscape/Mozilla users have both switched off.

MonkeeSage

9:37 am on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can do it with some JavaScript magic...
 <script type="text/javascript">
<!--
var b_timer = null; // blink timer
var b_on = true; // blink state
var blnkrs = null; // array of spans

function blink() {
var tmp = document.getElementsByTagName("span");
if (tmp) {
blnkrs = new Array();
var b_count = 0;
for (var i = 0; i < tmp.length; ++i) {
if (tmp[i].className == "blink") {
blnkrs[b_count] = tmp[i];
++b_count;
}
}
// time in m.secs between blinks
// 500 = 1/2 second
blinkTimer(500);
}
}

function blinkTimer(ival) {
if (b_timer) {
window.clearTimeout(b_timer);
b_timer = null;
}
blinkIt();
b_timer = window.setTimeout('blinkTimer(' + ival + ')', ival);
}

function blinkIt() {
for (var i = 0; i < blnkrs.length; ++i) {
if (b_on == true) {
blnkrs[i].style.visibility = "hidden";
}
else {
blnkrs[i].style.visibility = "visible";
}
}
b_on =!b_on;
}
//-->
</script>

A tad of CSS, e.g.,...

<style type="text/css">
.blink {
font-size: 15px;
color: red;
display: inline;
}
</style>

And a bit of mark-up...

...
<body onload="blink();">
...
This is a test of the <span class="blink">blinking text</span> thingy...which <span class="blink">blinks</span> (in theory)...
...

But just a warning, most people don't like alot of blinking stuff, so you probably should not over-use the effect.

Jordan

tigger

9:43 am on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>But just a warning, most people don't like alot of blinking stuff, so you probably should not over-use the effect

100% agree, blinking text is the biggest turn of for me other than sound

MonkeeSage

9:51 am on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



tigger:

Same here. I made the above functions based off some I made playing around with writing chromes for Mozilla / Firebird, so I could have a custom picture as a cursor in an editable textarea and have it blink. I also have a version that makes a button blink x times and then disappear after it is clicked. But just blinking text grates on my eyes, especially if there is alot of it everywhere and it's high-contrast, that's the worst. ;)

Jordan

RonPK

10:14 am on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's a CSS attribute for this too:

text-decoration: blink

AFAIK, only Mozilla and Opera support it.

gph

7:13 pm on Sep 7, 2003 (gmt 0)

10+ Year Member



b_on =!b_on;

I didn't know that was possible, thanks MonkeeSage

Nick_W

7:18 am on Sep 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have a look at this:
[webmasterworld.com...]

Nick

MonkeeSage

9:35 am on Sep 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



b_on =!b_on;

I didn't know that was possible, thanks MonkeeSage

Yup...in that context "!" is "opposite" instead of the usual "not". Only works with booleans. :)

Jordan

gph

10:21 pm on Sep 8, 2003 (gmt 0)

10+ Year Member



I used to think this was as condensed as it gets

b_on = b_on ? 0 : 1;

Learn something new every day :)

RonPK

5:51 am on Sep 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mine is shorter:

b_on ^= 1;

:)

dougmcc1

8:44 pm on Sep 9, 2003 (gmt 0)

10+ Year Member



b_on =!b_on;

I didn't know that was possible

Yup...in that context "!" is "opposite" instead of the usual "not". Only works with booleans. :)

I used to think this was as condensed as it gets
b_on = b_on? 0 : 1;

Mine is shorter:
b_on ^= 1;

lol. Only on WebmasterWorld.

gph

2:15 am on Sep 10, 2003 (gmt 0)

10+ Year Member



:)

Nice one Ron

 


 


 


 

Status: 403 Forbidden