View Single Post
Old 11-14-2012, 05:41 PM   PM User | #3
xdragon124
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 3
Thanked 0 Times in 0 Posts
xdragon124 is an unknown quantity at this point
Code:
$(document).ready(function(){
	var currentsong;
	
	$("#play-button").click(function(){
		if (currentsong == 1) {
			$("#audio-1")[0].play();
		}
		else if (currentsong == 2) {
			$("#audio-2")[0].play();
		}
		else if (currentsong == 3) {
			$("#audio-3")[0].play();
		}
		else if (currentsong == 4) {
			$("#audio-4")[0].play();
		}
		else {
			$("#audio-5")[0].play();
		}
	}) 
	
	$("#pause-button").click(function(){
		if (currentsong == 1) {
			$("#audio-1")[0].pause();
		}
		else if (currentsong == 2) {
			$("#audio-2")[0].pause();
		}
		else if (currentsong == 3) {
			$("#audio-3")[0].pause();
		}
		else if (currentsong == 4) {
			$("#audio-4")[0].pause();
		}
		else {
			$("#audio-5")[0].pause();
		}
	})
	
	$("#next-button").click(function(){
		if (currentsong < 5) {
			currentsong = currentsong + 1;
		}
		else if (currentsong == 5) {
			currentsong = 1;
		}
	})
})
this is the entire file currently.

I edited the comparison operators from = to ==, but now the buttons no longer function.

Thanks,

Last edited by xdragon124; 11-14-2012 at 06:03 PM.. Reason: Adding contextual information
xdragon124 is offline   Reply With Quote