• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic