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

Yehuda Shiran, Ph.D.
Doc JavaScript

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

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, 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