Scrolling HTML Basics, Part II: Internet Explorer's Problems - www.docjavascript.com
Netscape Navigator's Problems
As previously mentioned, we have found a few problems during our Internet Explorer's scroller implementation. Although we worked around them, we wanted to summarize what we found. Avoiding these problems in your scripts can save you a lot of debugging and frustration.
The first problem occurred during the external file's onload
event handling. The current implementation circumvents the problem by delaying the onload
action:
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
var pause = 100;
function start() {
setTimeout("parent.fillCanvas()", pause);
}
window.onload = start;
//-->
</SCRIPT>
Without a delay, the script calls fillCanvas()
two times, instead of the expected one. The following piece of code did not limit the calls to one either:
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
var numberOfCalls = 0;
function start() {
numberOfCalls ++;
if (numberOfCalls == 1) parent.fillCanvas();
}
window.onload = start;
//-->
</SCRIPT>
The second problem we have encountered is with placing the scroller in a loaded page, as we have done in our previous column, Scrolling HTML Basics, Part I: Netscape Navigator. This is the reason, by the way, that we launch the scroller to a new window in the current column. We observed that after adding more than two paragraphs of text to the scroller's page, the scroller freezes and does not slide. We did not figure out how to solve this problem yet.
Produced by Yehuda Shiran and Tomer Shiran
Created: December 7, 1998
Revised: December 7, 1998
URL: https://www.webreference.com/js/column31/problems