spacer
Yehuda Shiran February 24, 2000
Netscape Navigator's Delayed Printout
Tips: February 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

In Internet Explorer you can define a SPAN element and update its content -- all during loading of the page. In Netscape Navigator, this scenario does not work. Netscape cannot write to a SPAN element that has just been loaded. You have to put an event handler that will update the SPAN element when the page is fully loaded.

Let's take for example the Doc Dialer from Column 57. Here is the SPAN element:

<SPAN ID="foundSoFar" STYLE="position: absolute; border: 2px buttonface solid; width: 250"></SPAN>

The event handler in Netscape should be:

onload = start();

And the function start calls another function:

function start() {
  outputStringToDisplay(welcomeStr);
}

And this function does the update:

function outputStringToDisplay(str) {
  if (nameCode == 2) { // netscape
    with (document.foundSoFar.document) {
      open();
      write(str);
      close();
    }
  } 
  else {
    document.all.foundSoFar.innerHTML = str;
  }
}

Learn more about incompatibilities between the browser in Column 6, Browser Compatibility.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint