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