Back to Shut the Box Project

Shut the Box Project - JS and HTML updates

Additional Scripts Four

Instructions:

Although this is the the fourth update to scripts, we need to make changes in multiple places on the HTML files as well. Let's start with our JS file. Copy and Paste our new reset() function at the bottom of our stbScripts.js file. Also, copy and paste a new button script (second block of code below) that includes the onclick="reset()" command. Change the styles on the new button to meet your needs.


//reset tiles and clear array
function reset(){
    for (var i = 0; i < tileTotal.length; i++) {
        c=tileTotal[i];
        document.getElementById(c).style.visibility="visible";
        currentScore.splice(c-1,1,c);
    };
    tileTotal = Array();
    selectCount=0;
};
            
        <div id="reset">
            <button class="center bigText" onclick="reset()">Reset</button>

        </div>        
            
David Johns and Electric Teaching ~ All Rights Reserved 2015