...

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



pbucko
05-05-2007, 05:24 PM
http://maps.avnwx.com/scrolltest.html

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:


hello
<div id='myscroller'></div>
<script type="text/javascript">
//<![CDATA[
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.'+
'</font>';
startScroll("myscroller", content);
//]]>
</script>
there

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.

Thoughts?

-Peter Buckner

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

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

pbucko
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum