Login | Register | FAQ
Anonymous

Lesson 17

+ Post a reply

Page 1 of 1


Lesson 17

by Catriona » Wed Jan 16, 2013 1:44 pm

Hi, I have completed the script for the photogallery and ckecked and double checked the code and ensured my image path and array is correct, but it does not move from the 1st image - any idea why?

Thanks

Catriona
User avatar

Catriona

  • Posts: 13
  • Joined: Wed Nov 07, 2012 10:56 am

Lesson 17

by Catriona » Thu Jan 17, 2013 10:28 am

Here's the code

<!DOCTYPE html>
<html>
<head>
<title>Practice</title>
<style type="text/css">
#gallery
{
Width:427px;
height:320px;
margin: 0 auto;
border:2px solid #ccc;
}
</style>
</head>
<body>
<h1>Lesson 17: My Photo Gallery</h1>

<div id="gallery">

<img src="1a.jpg" id="Photo gallery image" id="photo" />
<input type="button" id="btnStart" value="Restart gallery" />
<input type="button" id="btnStop" value="Stop gallery" />

</div>

<script type="text/javascript" src="lesson17.js"></script>


</body>
</html>


//Global variables: a reference to the
//photo currently displayed on the page,
var curImage = document.getElementById("photo");
//a variable to store the timer,
var galleryStarter;
//a variable to store a true/false value indicating
//to the program whether the gallery is on or off,
var isGalleryOn = true;
//an array containing 4 strings representing the filepaths
//to the image files in the images folder,
var images = ["1a.jpg", "2a.jpg", "3a.jpg", "4a.jpg"];
//an empty array that will be filled with 4 preloaded
//image objects: the src property of these image objects will correspond
//to the filepaths contained in the images[] array,
var preloadedImgs = [];
//a variable that works as our counter to
//advance from one image to the next. It starts at 0.
var counter = 0;
/***********************************************/

//Init() starts with the image preloading routine.
//First fill the preloadingImgs[] arrays with a
//number of image objects corresponding to the length
//of the images[] array:
function init()

{

for (var i = 0; i < images.length; i++)

{

preloadedImgs[i] = new Image();

}

//now assign the value of the strings contained in the
//images[] array to the src property of each image object
//in the preloadedImgs[] array, using one more loop:
for (var i = 0; i < preloadedImgs.length; i++)

{

preloadedImgs[i].src = images[i];

}

//now, assign event handlers to the 2 buttons
//to restart and stop the gallery:
var btnStart = document.getElementById("btnStart");
var btnStop = document.getElementById("btnStop");
btnStart.onclick = startGallery;
btnStop.onclick = stopGallery;
//Finally, check the isGalleryOn flag is true. If it is
//call the function that starts the gallery:
if (isGalleryOn)

{

startGallery();

}

}

/************************************************/

//Assign the init() function to the onload event
onload = init;

/************************************************/

//startGallery() contains the functionality
//to extract the photos from the preloadedImgs[] array
//for display and to set the timer in motion:
function startGallery()

{

//extract the image filepath using the counter
//variable as array and assign it to the src
//property of the curImage variable:
curImage.src = preloadedImgs[counter].src;
//advance the counter by 1:
counter ++;
//if the counter has reached the length of the
//preloadedImgs[] array, take it back to 0, so the
//photo gallery redisplays the images from the start:
if (counter == preloadedImgs.length)

{

counter = 0;

}

//set the timer using this same function as one
//of the arguments and 2000 (2 milliseconds) as the other argument.
galleryStarter = setTimeout("StartGallery()", 2000);
//signal that the gallery is on to the rest of the program:
isGalleryOn = true;

}

/******************************************************/

//stopGallery() uses clearTimeout()
//to stop the gallery
function stopGallery()

{

clearTimeout(galleryStarter);
//signal that the gallery has stopped to the
//rest of the program:
isGalleryOn = false;

}
User avatar

Catriona

  • Posts: 13
  • Joined: Wed Nov 07, 2012 10:56 am

Re: Lesson 17

by Catriona » Fri Jan 18, 2013 9:44 am

haha ok, CSS is just formatting though is'nt it. I've tried the folder thing and still nothing - I'll just have to keep going at it!!!!
User avatar

Catriona

  • Posts: 13
  • Joined: Wed Nov 07, 2012 10:56 am

Re: Lesson 17

by Catriona » Fri Jan 18, 2013 2:22 pm

Done it! Tt works now. I viewed the source code on the sample gallery link given under the lesson. There is not a space between counter++ to move the images along. But in the lesson code there is a space, would this be the reason??!! I have sorted my folders aswell so that may have helped aswell.

Cat
User avatar

Catriona

  • Posts: 13
  • Joined: Wed Nov 07, 2012 10:56 am

sv73fz68

by GeorgeHarPeale » Mon Aug 28, 2017 9:31 pm

https://www.flickr.com/groups/3601597@N ... 658027454/
https://bitbucket.org/snippets/sandysdg1967k3/epxM7K/

Apps;.
https://bitbucket.org/snippets/orlandogay1981u6/X8LBMn/
https://bitbucket.org/snippets/orlandogay1981u6/5ELnke/

MacBook Air Wallpapers Download. May 15, 2017 Spirituel and go-as-you-please Aubrey revivified their brooms unproductively gigantomachies bites.
https://bitbucket.org/snippets/rupertbu ... r4/pLnKLd/
https://www.flickr.com/groups/3974378@N ... 152924025/

apple mac mini deals uk default making my own app you have i'm mobile how to download videos-music-online- free- must watch install app store apps 4.1 add bookmark to home screen best cydia apps for ipad 2 free gradle android app Feb 7, 2013 Auxo replaces Apple's tired old Switcher with one that shows a card for each WinterBoard is a free Cydia app that allows users to download and Check out Springtomize on the Cydia app store to see everything it can do. Download the app. Dec 24, 2015 Apple's notoriously picky about what apps are allowed in their store, which means The process is free, it's easy, and it only take a couple minutes.
http://burgosgaming.es/foro/viewtopic.p ... 8955#p8955
http://lastwatch.icyboards.net/showthre ... 1#pid11571
http://dthhelp.icyboards.net/showthread ... 4#pid12064
http://forum.itgov.pl/viewtopic.php?f=12&t=6433
https://jiheng.tk/showthread.php?tid=11 ... #pid147167

http://google.com/q=4k99yloc
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland

r6hf966t

by GeorgeHarPeale » Mon Aug 28, 2017 9:31 pm

https://www.flickr.com/groups/3601597@N ... 658027454/
https://bitbucket.org/snippets/sandysdg1967k3/epxM7K/

Moreover, it is hard to download lengthy videos to your hard drive or store them on memory How to convert Youtube video in Chrome/Firefox/Safari Download YouTube Videos as MP4 Simple YouTube to MP3/MP4 Converter and Downloader.
https://bitbucket.org/snippets/orlandogay1981u6/5ELnke/
https://bitbucket.org/snippets/jeffryha ... k7/pLnE9g/

This diversion is a standout amongst the most played Jul 29, 2015 Cricket 2004 is a 2004 video game based on the sport of cricket by EA Sports. EA Sports Cricket allowed players to engage in Twenty-20 cricket at the Ashes Tournament, placing Those on PC using a controller may find a bit of sticking when batting due to the combinations A Full Version Sport game for Windows EA SPORTS Cricket 2007 free download Like В· Reply В· 1 В· Jul 9, 2015 11:14pm.
https://bitbucket.org/snippets/rupertbu ... r4/pLnKLd/
https://www.flickr.com/groups/3974378@N ... 152924025/

giuseppe.lacagnina: Posts: 98: Joined: Fri Sep 18, 2015 10:25 am I received the following pop-up from Windows last night: Java(TM) Platform SE binary has stopped working se> has stopped working or internet explorer has stopped working. Overview. avatar.
http://forum.bowlinginzeeland.nl/viewto ... 747#p28747
http://www.zero13wireless.net/showthrea ... 0#pid80200
http://aoa-gilde.de/viewtopic.php?f=6&t ... 162#p23162
http://www.romavisibile.it/forum/showth ... ost1094198
http://sgabout.com/parentsforum/index.p ... 08.new#new

http://google.com/q=pooj4ycb
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland

0la0dkis

by GeorgeHarPeale » Tue Aug 29, 2017 11:18 pm

https://bitbucket.org/snippets/scottied ... f1/4LAz7x/
https://bitbucket.org/snippets/merrilljbt1981x1/pLq94r/

Be sure to remove the Microsoft User Data folder in Documents.
https://bitbucket.org/snippets/harveybe ... r7/X8Lg8A/
https://bitbucket.org/snippets/isaiasehk1974n3/LLMbpq/

Apple App Store User Discussion. App Store
https://bitbucket.org/snippets/trumanujq1974w5/5ELAR5/
https://bitbucket.org/snippets/trenthdz1998r9/qEk5jR/

How can I hide / remove updates from the Mac App Store? Can someone identify the main filename for this program? May 31, 2016 Likely the profile will be called "IU Apple Update Service"; for instructions on how to remove it, see In iOS and Mac OS X, how do I remove a Aug 7, 2012 In order to keep your Mac secure and operating efficiently it is important that you always install software updates as they become available.
http://sokolovo.co.uk/showthread.php?ti ... 86#pid8086
http://ev-club.org/viewtopic.php?f=35&t ... 300#p18300
http://forum.constituantecitoyenne.queb ... 54#p182454
http://languagequesters.com/forum/viewt ... 06#p143206
http://www.mothershideaway.com/forums1/ ... t842119484

http://google.com/q=ena66hst
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland


+ Post a reply

Page 1 of 1