Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 67 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
* {
box-sizing: border-box;
}
.hidden {
display: none;
}
.show {
display: inline;
}

body {
font-family: sans-serif;
Expand All @@ -26,13 +32,14 @@
}

#container {
background-color: pink;
background-color: rgb(22, 147, 68);
margin: 40px auto;
max-width: 800px;
padding: 38px 31px;
}

input {
background-color: rgb(92, 204, 133);
font-size: 21px;
line-height: 33px;
margin: 0 0 23px 0;
Expand All @@ -48,7 +55,7 @@
}

#output-div {
background-color: lightgrey;
background-color: rgb(92, 204, 133);
margin: 20px auto;
padding: 20px;
width: 100%;
Expand All @@ -59,19 +66,24 @@
<!-- The <body> element defines the document's body, and is a container for all the visible contents that will be rendered by the browser. -->
<body>
<!-- The <h1> element defines a large heading. There are 6 pre-set header elements, <h1> to <h6> -->
<h1 id="header">Basics! 🚀</h1>
<h1 id="header">♠ ♥️ HELLO! Black Jack! ♦️ ♣️</h1>
<!-- The <div> tag defines a division or a section in an HTML document, and is commonly use as a "container" for nested HTML elements. -->
<div id="container">
<!-- The <p> tag defines a paragraph element. -->
<p>Input:</p>
<!-- The self-closing <input /> tag represents a field for a user to enter input. -->
<input id="input-field" />

<!-- The self-closing <br /> tag represents a line break - a line's worth of spacing before dispalying the next element. -->
<br />
<!-- The <button> tag represents.. you guessed it! a button. -->
<button id="submit-button">Submit</button>
<button id="submit-button">Start</button>
<button id="hit-button" class="hidden">Hit</button>
<button id="stand-button" class="hidden">Stand</button>
<button id="refresh-button" class="hidden">Done</button>
<p>Output:</p>
<div id="output-div"></div>
<div id="output-div">
Welcome to Sern's Cards! Click the submit button to get started!
</div>
</div>
<!-- Everything below this is incorporating JavaScript programming logic into the webpage. -->
<!-- The script tag encloses JavaScript syntax for the browser to interpret programtically -->
Expand All @@ -83,18 +95,63 @@ <h1 id="header">Basics! 🚀</h1>
var button = document.querySelector("#submit-button");
// When the submit button is clicked, access the text entered by the user in the input field
// And pass it as an input parameter to the main function as defined in script.js

button.addEventListener("click", function () {
// Set result to input value
var input = document.querySelector("#input-field");

// Store the output of main() in a new variable
var result = main();

// Display result in output element
var output = document.querySelector("#output-div");

output.innerHTML = result;
});

// new added button

var standButton = document.querySelector("#stand-button");

standButton.addEventListener("click", function () {
// Set result to input value

// Store the output of main() in a new variable
var result = showResults();

// Display result in output element
var output = document.querySelector("#output-div");

output.innerHTML = result;
});

// new added button 2

var hitButton = document.querySelector("#hit-button");

hitButton.addEventListener("click", function () {
// Set result to input value

// Store the output of main() in a new variable
var result = main(input.value);
var result = playerDraw();

// Display result in output element
var output = document.querySelector("#output-div");

output.innerHTML = result;
});

var refreshButton = document.querySelector("#refresh-button");

refreshButton.addEventListener("click", function () {
// Set result to input value

// Store the output of main() in a new variable
var result = refreshPage();

// Reset input value
input.value = "";
// Display result in output element
var output = document.querySelector("#output-div");

output.innerHTML = result;
});
</script>
</body>
Expand Down
Loading