I am trying to make a slideshow-like thing with JavaScript for a website and it isn't going well. What I want it to do is after one click change it so that it returns correctly.
Here is the code:
function previous_slide()
{
document.getElementById('banner').className = 'banner_2';
}
I'd like to make that single function switch between its current action and this one:
document.getElementById('banner').className = 'banner_1';
so that when you press the previous button once it changes the style to banner_2
and then when you press it again it returns to banner_1
.
` are generally non-semantic and should be used in rare instances. They're also unnecessary on SO. – outis Jun 07 '12 at 19:16