View Full Version : removing empty <script> </script> in header breaks script

05-05-2007, 05:24 PM

you'll see simple html page which displays vertically scroll text... the JS file is included at js/scroller.js.

scrolltest.html HEAD is two lines:

<script src="js/scroller.js" type="text/javascript"/>
<script type="text/javascript"></script>

The BODY includes script to actually initialize and invoke the scroller:

<div id='myscroller'></div>
<script type="text/javascript">
var content='<font face="Arial" color="blue" style="font-size:12px;">'+
'This is the first line of text<br/>'+
'This would be the second<br/>'+
'This is a longer line of text which, because it is longer'+
' than the "scroller width" in the scroller.js, it will'+
' wrap somewhere.<br/>'+
'This would be the last one.'+
startScroll("myscroller", content);

My problem -- question -- If I simply remove the second line from the HEAD... the otherwise empty <script>...</script> line... The page fails to work.

In Safari it works okay, but in Firefox I only see the word "there": no scrolling list, no errors in firebug. (That word, "there", is included directly in the body of the HTML file, and would normally appear after the scrolling list.

Also, if (rather than delete) I merely switch the order of the two lines in HEAD, the page will fail in the same manner in firefox.


-Peter Buckner

Philip M
05-05-2007, 05:34 PM
Change it to

<script type="text/javascript" src="js/scroller.js"></script>

05-05-2007, 05:44 PM
yes, it does, of course.

Thanks for the extra pair of eyes. Now I can continue to improve my scroller.

-Peter Buckner