spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column22


Behavior Emulation with IE 4.0x

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

In principle, Behavior functionality can be emulated with Internet Explorer 4.0x. In our example, a blinking image can be created using IE 4.0x's DHTML objects. Images can be moved and made invisible by manipulating their object's properties, such as visibility, left, and top attributes. Here is the full script:


<HTML>
<HEAD>
<TITLE> Soccer: World Cup is Over </TITLE>
</HEAD>
<BODY ONLOAD="soccerOnload()">
<DIV ID="soccer" STYLE="position:absolute; left:200; top:250"> -->
  <IMG SRC="bigsoccer.gif"></DIV>
<SCRIPT LANGUAGE="JavaScript">
var msecs = 2000;
var counter = 0;

function soccerOnload() {
  setTimeout("blink()", msecs);
}

function blink() {
  soccer.style.visibility =  -->
    (soccer.style.visibility == "hidden") ? "visible" : "hidden";
  counter +=1;
  if (counter == 10) {
    alert("Fifth Blink Point");
    counter = 0;
  }
  setTimeout("blink()", msecs);
}

</SCRIPT>
</BODY>
</HTML>

Notice we have added a small feature to our blinking soccer ball: an alert box that pops up every five blinks. We picked a simple event so it will be easier to explain later in this column how to implement an event with Behaviors.

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: July 19, 1998
Revised: July 19, 1998

URL: http://www.webreference.com/js/column22/emulate.html