Forums

This topic is locked

Weird Image Scrolling Script...Please Help

Posted 12 Jun 2005 17:43:42
1
has voted
12 Jun 2005 17:43:42 Mark Forman posted:
<b>People,</b>

Can someone please take a look at this scrolling graphic & tell me what’s wrong with the script?:

mysite.verizon.net/vze3yjbu

I had wanted to add a graphic of a sound wave to my new site (created in Dreamweaver MX...which will be a resource site for digital musicians when complete); & to have it scroll across the page to resemble an audio track during playback in a computer-based digital audio workstation.

I created the graphic myself; & thought I had it configured properly with an appropriate java script to scroll at just the right speed…but when I uploaded the site, the script caused it to scroll just fine…but the cursor on the page undergoes a rapid-fire toggling between the cursor arrow & the hourglass.

One java programmer tells me it’s because the cursor is switching between normal & busy…due to the fact that the code is making a server call at the same rate the script causes it to scroll.

Another told me the problem can be fixed if the coding sets up the graphic to cache.

Here's the script:

&lt;script&gt;
function moveBackground(x) {
var obj = document.getElementById('testy');
obj.style.backgroundPosition = ""+x+"px 0px";
setTimeout("moveBackground("+(x+1)+"",25);
}
&lt;/script&gt;

&lt;body onload="moveBackground(0);"&gt;

&lt;div id="testy" style="background:url(graphic.jpg) repeat-x; height<img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle>Xpx; width<img src=../images/dmxzone/forum/icon_smile_kisses.gif border=0 align=middle>XXpx;"&gt;&nbsp;&lt;/div&gt;

The only thing I did (if you view my source code) was to add absolute positioning to the layer, so as to have it scroll across the page at the height & position I wanted.

Can somebody help me out, here?...I’m not a programmer…but this page is almost there…almost working.

Thanks very much,

<b>mark4man</b>

Reply to this topic