spacer
Yehuda Shiran February 14, 2000
Creating A Banner
Tips: February 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
Creating a banner in Netscape Navigator is very tricky. We have already showed in our tip from January 30, 2000 how to write into a banner container. But this is only one of the difficulties. There are several other items that you need to pay attention to:

  • Absolute Positioning. Your SPAN element must be placed in absolute positions. Notice the STYLE attribute of our SPAN element:
    <SPAN ID="banner" STYLE="position: absolute;"><I>the banner is loading</I></SPAN>

  • Timing. You have to load the banner only after the page completes its loading. You do it by specifying the event handler:
    onload = start;

    where start() is the following function:

    function start() {
      display("banner", "Navigator behaves totally differently from Explorer");
    }

  • Open and Close Document. You can't just write to the banner. You have to open it, write to it, and close it:
    with (document[id].document) {
          open();
          write(str);
          close();
        }

Again, I cannot stress enough how much the above topics are impoartant. Here is a banner script. Try to omit some features and observe its consequences.

<HTML>
<HEAD>
<TITLE>Title Here</TITLE>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--

var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;

onload = start;

function start() {
  display("banner", "Navigator behaves totally differently from Explorer");
}

function display(id, str) {
  if (NS4) {
    with (document[id].document) {
      open();
      write(str);
      close();
    }
  } else {
    document.all[id].innerHTML = str;
  }
}

// -->
</SCRIPT>
</HEAD>
<BODY>
<SPAN ID="banner" STYLE="position: absolute;"><I>the banner is loading</I></SPAN><BR><BR>
</BODY>
</HTML>

Learn more about text banners in Column 3, Rotating Text Banners.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

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

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags