<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>> http://xn--ovg.com/marquee/index3.php<BR>> <BR>> What did I do wrong?<BR>> <BR>> tedd<BR><BR>
The obvious:<BR>
An attempt to manipulate the DOM before it comes to existence<BR>
is being made because you've misplaced the script.<BR>
<BR>
The first line of script will cause the error trying to assign:<BR>
<BR>
var roller = document.getElementById('roller')<BR>
<BR>
Because the DIV with ID "roller" is not created yet.<BR>
Please, place the script at least one line after the "roller" closing tag<BR>
and everything will come back to normal - it will loop forever.<BR>
Or simply copy - paste this code: [with the same order!] <BR>
(Given are new dimensions to suite your pictures size too)<BR>
<BR>
<style><BR>#holder{<BR> position:absolute;<BR> left:45px;<BR> top:116px;<BR> width:344px;<BR> height:84px;<BR> overflow:hidden;<BR> }<BR>
#roller {<BR> white-space:nowrap; margin-left:0;<BR>}<BR>
</style><BR>
<BR> <div id="holder"> <BR> <div id="roller"><BR> <img src="images/1.jpg" alt="" ><BR> <img src="images/2.jpg" alt="" ><BR> <img src="images/3.jpg" alt="" ><BR> <img src="images/4.jpg" alt="" ><BR> <img src="images/5.jpg" alt="" ><BR> <img src="images/6.jpg" alt="" ><BR> <img src="images/7.jpg" alt="" ><BR> <img src="images/8.jpg" alt="" ><BR> <img src="images/9.jpg" alt="" ><BR> <img src="images/1.jpg" alt="" ><BR> <img src="images/2.jpg" alt="" ><BR> <img src="images/3.jpg" alt="" ><BR> </div><BR> </div><BR>
<BR>
<SCRIPT><BR>var roller = document.getElementById('roller')<BR>var i=0;<BR>
function rollnow(){<BR> if(i < 1040){<BR> i++;<BR> roller.style.marginLeft=-i;<BR> }else{i=-4}<BR> }<BR>
window.setInterval(rollnow, 20);<BR></SCRIPT><BR>
<BR>
The correct calculation is: 9 (images) * 112 (actual imgs width) + ( 9 - 1 * 4 ) = 1040 px<BR>
Tip: To get this value automaticaly "comment" the repeated images 1,2,3, in the code and <BR>
alert(roller.offsetWidth) inside the script in IE or NN (except that NN will give exact value only<BR>
in the second alert because the first time it will report the "holder" width instead of the "roller")<BR>
and don't forget to uncomment the images after you've written the required strip width; this time<BR>
being 1040.<BR>
<BR>
P.S.:<BR>
!!! I've miscalculated the blank space between images for half of it's real width<BR>
in the last post; the correct value is <FONT>4px </FONT>!!!<BR>
<BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR> Troy III<BR> progressive art enterprise<BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR><br /><hr />With MSN Spaces email straight to your blog. Upload jokes, photos and more. It's free! <a href='http://clk.atdmt.com/MSN/go/msnnksac0030000001msn/direct/01/?href=http://www.imagine-msn.com/spaces' target='_new'>It's free!</a></body>
</html>