spacer

home / experts / dhtml / column25 / addendum1
Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Logo

Dynamic Headline Fader, Version 2.01
accounting for the this problem in NS4mac


The Problem

Brian McNett alerted us to the following problem:
In Netscape 4.04, on the Mac, double-clicking on the fader to restart is broken. Netscape returns the following error:

This problem exists on other NS releases, like 4.05, as well. More recent versions have fixed the bug.

Judging from the error message, one assumes the problem is with the releaseEvents() method. It isn't.

In some releases of NS4mac, there is a bug with the assignment of the this keyword.

The statement that generates the error is in our FDRend() function:

function FDRend(){
   .
   .
   .
   if (FDRreplayOnClick) {
      .
      .
      .
      if (IE4) {
         .
         .
         .
      }
      else {
         elFader.captureEvents(Event.DBLCLICK);
         elFader.ondblclick = function(){

            this.releaseEvents(Event.DBLCLICK);

            FDRstart(startIndex);
            return false;
         }
      }
   }
}

The syntax is correct, and this should refer to the elFader object. In some versions of NS4mac, this is not assigned to the correct object, and, in our script, whatever object this is assigned to, does not have a releaseEvents() method, so the error is generated.

The Solution

We'll avoid the this bug completely, by referring to the elFader object directly:

function FDRend(){
   .
   .
   .
   if (FDRreplayOnClick) {
      .
      .
      .
      if (IE4) {
         .
         .
         .
      }
      else {
         elFader.captureEvents(Event.DBLCLICK);
         elFader.ondblclick = function(){

            elFader.releaseEvents(Event.DBLCLICK);

            FDRstart(startIndex);
            return false;
         }
      }
   }
}

We're finished, but for some final comments.


Produced by Peter Belesis and

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

All Rights Reserved. Legal Notices.
Created: Sep 21, 1999
Revised: Sep 21, 1999

URL: http://www.webreference.com/dhtml/column25/addendum1/fdr201nsmac.html