SiteExperts.com Logo Home | Community | Developer's Paradise | Jobs
User Groups | Site Tools | Site Information | Search

Inside Technique : Cross Browser BLINK Element : IE5 Blink Behavior

Using IE5 behaviors, you can associate new behavior with any element supported by the browser. We created the blink behavior for quickly and easily applying blink to your web-page. You associate the behavior with an element using CSS. Below we associate our blink behavior script defined in blink.htc with the blink element.

<STYLE>
<!--
  @media screen
  {
    blink { behavior:url(blink.htc);}
  }
-->
</STYLE>

In Internet Explorer 5.0, the blink.htc file is downloaded and automatically applied to the blink element. No other script is necessary on the page itself. Instead, all the script is contained in the blink.htc file as defined below:

<PUBLIC:PROPERTY NAME="speed" />
<PUBLIC:METHOD NAME="doBlink" />
<PUBLIC:ATTACH event="oncontentready" handler="Init" />

<SCRIPT>
// Copyright 1999 InsideDHTML.com, LLC.
function doBlink() {
  this.style.visibility = this.style.visibility=="" ? "hidden" : ""
}

function Init() {
  if (!speed) speed=1000
  setInterval(uniqueID+".doBlink()",speed)
}
</SCRIPT>

When creating the blink behavior we realized that it was missing a key feature for taking control over your blinking text. We decided to enhance the Netscape blink tag for Internet Explorer 5.0 by adding a speed attribute. By setting the speed attribute, you can provide your visitors a greater service by blinking faster or slower. The speed attribute specifies the number of milliseconds between blinks:

<BLINK SPEED=1000>
  Blink every second
</BLINK>

As a closing note, if all this blinking text starts giving you wild ideas about implementing the LAYER element in the same fashion, Internet Explorer does not parse this element so it is not treated as a container. In short, it can't be done (or at least without an extremely large amount of very complex code).

We hope you enjoyed our exploration into the lighter side of DHTML Scripting. If anyone thinks they have a good application for blinking text, please let us know.

Discuss and Rate this Article

Page 1:Cross Browser BLINK Element
Page 2:Scripting Blink
Page 3:IE5 Blink Behavior