Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function populateBands(){
- var option;
- for(var i=0;i<choices.favoriteBand.length;i++){
- option = document.createElement('option');
- option.text = choices.favoriteBand[i].name;
- option.value = choices.favoriteBand[i].name;
- favoriteBandSelector.appendChild(option);
- }
- }
- function populateAlbums(){
- favoriteAlbumSelector.options.length=0;
- selectedBandIndex = favoriteBandSelector.selectedIndex;
- var albumsToPopulate = choices.favoriteBand[selectedBandIndex].albums;
- var option;
- for(var i=0;i<albumsToPopulate.length;i++){
- option = document.createElement('option');
- option.text = albumsToPopulate[i].name;
- option.value = albumsToPopulate[i].name;
- favoriteAlbumSelector.appendChild(option);
- }
- populateSongs();
- }
- function populateSongs(){
- favoriteSongSelector.options.length = 0;
- selectedAlbumIndex = favoriteAlbumSelector.selectedIndex;
- var songsToPopulate = choices.favoriteBand[selectedBandIndex].albums[selectedAlbumIndex].songs;
- var option;
- for (var i=0;i<songsToPopulate.length;i++){
- option = document.createElement('option');
- option.text = songsToPopulate[i];
- option.value = songsToPopulate[i];
- favoriteSongSelector.appendChild(option);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement