aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes how do i make a javascript slideshow using an array with imags and videos? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how do i make a javascript slideshow using an array with imags and videos?" Watch "how do i make a javascript slideshow using an array with imags and videos?" New topic
Author

how do i make a javascript slideshow using an array with imags and videos?

zsac vava
Greenhorn

Joined: Nov 30, 2012
Posts: 1
im not sure how to make my slideshow work i have a next button and previous button and it switch fine just once it goes to the videos then nothing comes up is here my html and javascript not sure on how to fix this

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>javascript homework 2</title>



<link href="css/styles.css" rel="stylesheet" type="text/css">
</head>

<body>
<div id="mainImg">
<h2 id="caption">movie1</h2>
<video id="myVideo" width="540">
<source src="video/movie1.mp4" type="video/mp4"/>
<source src="video/movie1.webm" type="video/webm"/>
<source src="video/movie1.ogv" type="video/ogg"/>
</video>



</div>
<div id="controls">
<div id="playToggle" class="player-button">Play</div>
</div>

<div id="links">

</div>

</body>
<script src="js/js.js"></script>
</html>

var currentImage = 0;



var count = 0;
var videos = new Array("movie1", "movie2", "movie3","Dk1", "Dk2", "Dk3");


var captions = new Array("movie1", "movie2", "movie3", "Dark Knight 1", "Dark Knight 2", "Dark Knight 3");


var video = document.createElement("video");
var playPauseButton = document.getElementById('playToggle');


function switchVideo() {
video.setAttribute('src',videoPaths[CurrentVideos]);
video.onload = function() {
currentVideo++;
if (currentVideo >= videoPaths.length) {
currentImage = 0;
}

}
}



function changeVideo(movie)
{
var thisVideo = "video/"+videos[movie]+".mp4";
document.getElementById("myVideo").src = thisVideo;
document.getElementById("caption").innerHTML = captions[movie];
count = movie;
}

function nextPhoto()
{
count++;

if(count==videos.length)
{
count = 0;
}

var thisVideo = "video/"+videos[count]+".mp4";
document.getElementById("myVideo").src = thisVideo;
document.getElementById("caption").innerHTML = captions[count];
}

function prePhoto()
{

count--;

if(count < 0)
{
count = videos.length-1;
}

var thisVideo = "video/"+videos[count]+".mp4";
document.getElementById("myVideo").src = thisVideo;
document.getElementById("caption").innerHTML = captions[count];
}

playPauseButton.onclick = function() {
if (myVideo.paused) {
myVideo.play();
this.innerHTML = "Pause";
} else {
myVideo.pause();
this.innerHTML = "Play";

}

};
 
Don't get me started about those stupid light bulbs.
 
subject: how do i make a javascript slideshow using an array with imags and videos?