If you use a table, for IE you must initialize outside (after) the table. I hadn't realized this until you pointed out the problem though (I rarely use tables for new work any more), and I can only imagine for the time being why it is this way (in IE 7 and 6 at least). I'm a bit busy though right now though this has me intrigued, so I will probably test in 8, 5, and 5.5 to see what's what with that one.
BTW. Even though the style is pretty much as you seem to understand it. It's really much simpler. Basically you have:
HTML Code:
<div class="marquee#"> <!-- static position -->
<div> <!-- relative position -->
<div> content </div> <!-- absolute position -->
<div> content </div> <!-- absolute position -->
</div>
</div>
I only added the static positioned wrapper for IE 8. It needs to have a static wrapper with overflow hidden, otherwise it makes a a horizontal scrollbar for the page, even though the relatively positioned element also has overflow hidden - this is a bug in IE 8 RC1 that can be duplicated using only hard coded HTML markup, and has nothing to do with the script.
But, if it were not for this messiness with the table in IE - whatever that is - styling the relatively positioned container would be sufficient for styling the marquee. The static container is irrelevant really. It's just that once you put a marquee in and initialize it in a table in IE, in addition to the error it gives, even if you comment out those lines (they are for fine tuning the width), a number of the styles get lost, both those configured in initialization, and those used by the script internally.
Try these two demos, good:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="crawler.js">
/* Text and/or Image Crawler Script ©2009 John Davenport Scheuer
as first seen in http://www.dynamicdrive.com/forums/
username: jscheuer1 - This Notice Must Remain for Legal Use
*/
</script>
</head>
<body>
<table>
<tr>
<td><div class="marquee" id="mycrawler">
Those confounded friars dully buzz that faltering jay. An appraising tongue acutely causes our courageous hogs. Their fitting submarines deftly break your approving improvisations. Her downcast taxonomies actually box up those disgusted turtles.
</div></td>
</tr>
</table>
<script type="text/javascript">
marqueeInit({
uniqueid: 'mycrawler',
style: {'width': '450px',
'background': 'lightyellow',
'border': '1px solid #CC3300',
'height': '2em',
'padding': '2px'
},
inc: 8, //speed - pixel increment for each iteration of this marquee's movement
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
moveatleast: 4,
neutral: 150,
savedirection: true
});
</script>
</body>
</html>
Bad:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="crawler.js">
/* Text and/or Image Crawler Script ©2009 John Davenport Scheuer
as first seen in http://www.dynamicdrive.com/forums/
username: jscheuer1 - This Notice Must Remain for Legal Use
*/
</script>
</head>
<body>
<table>
<tr>
<td><div class="marquee" id="mycrawler">
Those confounded friars dully buzz that faltering jay. An appraising tongue acutely causes our courageous hogs. Their fitting submarines deftly break your approving improvisations. Her downcast taxonomies actually box up those disgusted turtles.
</div><script type="text/javascript">
marqueeInit({
uniqueid: 'mycrawler',
style: {'width': '450px',
'background': 'lightyellow',
'border': '1px solid #CC3300',
'height': '2em',
'padding': '2px'
},
inc: 8, //speed - pixel increment for each iteration of this marquee's movement
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
moveatleast: 4,
neutral: 150,
savedirection: true
});
</script>
</td>
</tr>
</table>
</body>
</html>
Added Later:
Also, in an unrelated matter, I've just updated the script due to another IE bug. I had named all functions, even those assigned to objects or variables. This can sometimes prove problematic in IE, even though it is valid and a good practice. The new version simply removes all such naming.
As to IE, 5.01, 5.5, 6, and 7 all have a problem with the 'bad' example above. 8 is fine with both the good and the bad, as are I'm sure all other modern browsers.
I've also added to my demo page:
Important Note: If you are using a marquee within a table, due to a table rendering bug in IE less than 8, you must initialize after the closing </table> tag.
See also:
http://home.comcast.net/~jscheuer1/s...table_good.htm - Good in IE with table
http://home.comcast.net/~jscheuer1/s.../table_bad.htm - Bad in IE with table
Bookmarks