Combining JavaScript and CSS

If you‘ve been following along this far with the Bingo example, you may well be wondering, “Hey, they said that JavaScript was all about the interactivity—why haven’t we seen any user interaction?” That’s a reasonable question, and here, we show how to now let the user actually play that Bingo card you generated. To do that, Script 3.11 uses some JavaScript to leverage the power of CSS.

Script 3.11. Adding a class via JavaScript allows our code to leverage the power of CSS.
window.onload = initAll; var usedNums = new Array(76); function initAll() { if (document.getElementById) { document.getElementById("reload").onclick = anotherCard; newCard(); } else { alert("Sorry, your browser doesn't support this script"); } ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.