PHP/JavaScript? - Timer to hide/show DIVs?

vbimport

#1

I want to make the following:

I have 2 DIVs

<div>
1
</div>

and

<div>
2
</div>

Now I want to show only the first one, and after 10 seconds I want to hide the first one and show the second one. Then after 10 secs vice versa etc etc etc.

How can I do this easily?

I have already written 2 functions in javascript ( one() and two() ) to hide/show the div's... but how can I build a timer? I don't see any option in PHP for it.... perhaps javascript??


#2

Hooo

just fixed it :slight_smile:

For the ones who are interested:

function SwitchPic(counter){
if(counter < HowLongBetweenPic){
counter++;

var res = eval(“Rollpic” + PicNumber);
if (res == ‘een’) {
show(‘een’);
hide(‘twee’);
}
if (res == ‘twee’) {
show(‘twee’);
hide(‘een’);
}

	//function calls itself
	CallSwitchPic=window.setTimeout("SwitchPic("+counter+")",1500); 
	}
	else{
		//if its not the last picture goto the next picture
		if(PicNumber &lt; NumberOfPictures){
			PicNumber++;
			SwitchPic(0);
		}
		//its the last picture go to the first one
		else{
			PicNumber=1;
			SwitchPic(0);
			}
	}

}


#3

The PHP book I lent you paying off? :wink:


#4

This is javascript tax :slight_smile:


#5

Originally posted by MP|3
This is javascript tax :slight_smile:

Have a book on that too, want to borrow that one too, you borrowed all others already :smiley:


#6

Originally posted by Da_Taxman

Have a book on that too, want to borrow that one too, you borrowed all others already :smiley:

hmm that would be nice !! :stuck_out_tongue:


#7

Perhaps you want to borrow my car, stereo, PC and life too? You got everything else already :stuck_out_tongue:

(better stop here, things getting too much off topic this way)

ps if I can find the book I’ll bring it upcoming Tuesday…then you can see my new car too :wink:


#8

Can I come shop in your personal library to some time?