views:

212

answers:

4

Hello, I'm trying to make Javascript change the style of certain DIV IDs by changing their background every few seconds. Basically, a fading header...here's my code, and it just doesn't change the background, at all.

How do you call a function?

http://pixolia.net/sandbox/morph/index.php

+5  A: 

Your javascript is in functions and isn't being called from anywhere. Try calling one of the functions from window.onload, or $(document).ready(function(){ }); if you're using jQuery

Mike Robinson
Yeah, you have to actually call a function. It doesn't just call itself.
Nick
I know - that's what I'm asking...how do I call the function?
dmanexe
And btw, danbirlem is using Prototype.
geowa4
Yeah he kinda changed the entire question since I posted my answer.
Mike Robinson
A: 

you could do something like this

<body onload="Appear(id1, id2);">

that way when the page loads it starts the fadein/out

Nick
A: 

With the version I just saw up there, the onload call to Appear(id1, id2) is failing because id1 and id2 are not yet defined.

Either define id1 and id2, e.g ... pics_array[2] = pic2; var id1 = 0; var id2 = 0;

but since its an onload function only getting called once, you may as well change the body tag to

The only problem then is the code falls over on this line: new Effect.Appear('appear-div');

probably because the file effects.js can't be found.

David Archer
A: 

sorry, ... change the boday tag to ... onload="Appear(0, 1);"

David Archer