A Pen by Yaakov Shore on CodePen.
Created
October 18, 2018 14:48
-
-
Save DewofyourYouth/78521c4548cf091a59e9edd60e88974c to your computer and use it in GitHub Desktop.
Multiplication Table - Web School
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="row"> | |
<div class="col-12"> | |
<div id="multi-table"> </div> | |
</div> | |
</div> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var table = document.getElementById('multi-table'); | |
function makeTable(){ | |
var tableContent = `<table class="table">`; | |
for(var i = 1; i < 11; i ++){ | |
for(var j = 1; j < 11; j++){ | |
tableContent += `${j == 1 ? "<tr>" : ""}<td ${i == 1 || j == 1 ? 'class="gray"' : ''} id="cell-${j*i}">${j*i}</td>${j == 10 ? "</tr>" : ""}`; | |
} | |
} | |
tableContent += "</table>"; | |
return tableContent; | |
} | |
table.innerHTML = makeTable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.table { | |
text-align: center; | |
} | |
.gray { | |
background-color: #ccc; | |
font-weight: bold; | |
} | |
#cell-25 { | |
background-color: #00ff00; | |
} | |
#cell-100 { | |
color: #fff; | |
font-weight: bold; | |
background-color: #0000ff; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.2/css/bootstrap.min.css" rel="stylesheet" /> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment