SHARE
TWEET

Untitled

a guest Oct 21st, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function populateBands(){
  2.     var option;
  3.    
  4.     for(var i=0;i<choices.favoriteBand.length;i++){
  5.         option = document.createElement('option');
  6.         option.text = choices.favoriteBand[i].name;
  7.         option.value = choices.favoriteBand[i].name;
  8.         favoriteBandSelector.appendChild(option);
  9.     }
  10. }
  11.  
  12. function populateAlbums(){
  13.     favoriteAlbumSelector.options.length=0;
  14.     selectedBandIndex = favoriteBandSelector.selectedIndex;
  15.     var albumsToPopulate = choices.favoriteBand[selectedBandIndex].albums;
  16.     var option;
  17.     for(var i=0;i<albumsToPopulate.length;i++){
  18.         option = document.createElement('option');
  19.         option.text = albumsToPopulate[i].name;
  20.         option.value = albumsToPopulate[i].name;
  21.         favoriteAlbumSelector.appendChild(option);
  22.     }
  23.     populateSongs();
  24. }
  25.  
  26. function populateSongs(){
  27.     favoriteSongSelector.options.length = 0;
  28.     selectedAlbumIndex = favoriteAlbumSelector.selectedIndex;
  29.     var songsToPopulate = choices.favoriteBand[selectedBandIndex].albums[selectedAlbumIndex].songs;
  30.     var option;
  31.     for (var i=0;i<songsToPopulate.length;i++){
  32.         option = document.createElement('option');
  33.         option.text = songsToPopulate[i];
  34.         option.value = songsToPopulate[i];
  35.         favoriteSongSelector.appendChild(option);
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top