jsFiddle page171

by Professor Tom DeDonno

HTML

<div id="lightbox">
We need to creat inside elements
</div>

JavaScript

var e = { /* key: value */
"lbCounter" : null,  "lbPrev" : null,
"lbNext" : null,   "lbPlay" : null,
"lbImages" : null };
/* book is creating 5 objects lbCounter..lbImages
   will will be using an associatiive */

function createLightBox( ) {

	   alert( "In createLightBox" );

     let lightBox = document.getElementById( "lightbox" );
     let lbTitle = document.createElement( "h1");
     lbTitle.id = "lbTitle";
     lightBox.appendChild( lbTitle );
     
     for( var key in e ) {  
     		e[key] = document.createElement( "div" );
        console.log( key + ": " + e[key] );
        lightBox.appendChild( e[key] );
        e[key].id = key;
        e[key].innerHTML = "Created:" + key;
        }
}
window.addEventListener( "load", createLightBox );