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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help with my scrolling marquee. Only works after mouseover.

Status
Not open for further replies.

ratinakage

Programmer
Feb 26, 2006
18
0
0
ZA
Hi guys,

I am pretty new to Javascript. I pulled some code of a tutorial website to make a scrolling marquee, then adjusted it to the size of my images. It seems to work OK.

The only problem is, it only starts working when you put your mouse over it. I need to start scrolling automatically when the page is loaded.

Does anyone know how I need to alter the script to make this happen?

I put up the site on:

- that's the javascipt.

Any help would be much appreciated.

Thanks!!
G
 
Have you tried moving the contents of the 'onmouseover' function into the 'start' function? That would seem logical to me.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Hey BillyRayPreachersSon,

I tried what you said. I changed the start method to the following:

Code:
function start() {
	clearTimeout(mqr[0].TO);
   new mq('m1',mqAry1,160);
   new mq('m2',mqAry2,160);// repeat for as many fuields as required
   mqRotate(mqr); // must come last
}

Now I don't see the images at all...

Like I say, pretty new to javascript so, still not sure how it works.

I've zipped up the test site and put it here if you feel like downloading it and testing the fix.
Any more help would be appreciated... :D
 
Also tried this:

Code:
function start() {
   new mq('m1',mqAry1,160);
   new mq('m2',mqAry2,160);// repeat for as many fuields as required
   clearTimeout(mqr[0].TO);
   mqRotate(mqr); // must come last
}
It does as in the original. Only works after the mouseover...
 
Get Firefox and then get the Firebug extension for Firefox. Learn how to use Firebug to debug your code in this browser. There are many things you can do - including stepping through your code line by line in the Firebug debugger... and this may open your eyes to the cause of your code not working.

Cheers,
Jeff

[tt]Visit my blog [!]@[/!] Visit Code Couch [!]@[/!] [/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
The reason your code is failing is because it is erroring due to you not having a div with ID of 'm2' on your page, yet your code is assuming it is present.

Fix this, use the one line (mqRotate(mqr);) in your start function, and you should be set.

How did I find this? Putting your code on different lines certainly helped... it's so hard to debug code when all on one line.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top