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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

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:


The Network for Technology Professionals

Search:

About Internet.com

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

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger