Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird Image Scrolling...Please Help

Status
Not open for further replies.

SonicMax

Technical User
Sep 14, 2003
62
0
0
US
People,

Can someone please take a look at this scrolling graphic (implemented via java scripting) & tell me what’s wrong with the script...or if there's a proprietary script in Dreamweaver I should have used instead?:


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:

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

<body onload="moveBackground(0);">

<div id="testy" style="background:url(graphic.jpg) repeat-x; height:XXpx; width:XXXpx;">&nbsp;</div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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…& the page is almost working...but should this have been done with Timelines or styles instead?

Thanks very much,

Sonic Max
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top