-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added customized player names #71
base: dev
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,13 @@ function newGame() { | |
score1.textContent = '0'; | ||
current0.textContent = '0'; | ||
current1.textContent = '0'; | ||
var r = confirm("Would you like to change the name of players?"); | ||
if (r == true) { | ||
var person = prompt("Please enter your name", player0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
document.getElementById("name-0").innerHTML =person; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
var person2 = prompt("Please enter your name", player1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
document.getElementById("name-1").innerHTML =person2; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
} | ||
document.querySelector('.player-0-panel').classList.add('active'); | ||
document.querySelector('.player-1-panel').classList.remove('active'); | ||
document.querySelector('.dice').style.display = 'none' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,6 @@ | |
<div class="player-current-score" id="current-0">0</div> | ||
</div> | ||
</div> | ||
|
||
<div class="player-1-panel"> | ||
<div class="player-name" id="name-1">Player 2</div> | ||
<div class="player-score" id="score-1">0</div> | ||
|
@@ -76,4 +75,14 @@ | |
<script src="app.js"></script> | ||
<!-- body ends here --> | ||
</body> | ||
<script> | ||
var player0 = prompt("Please enter your name", "Player 1"); | ||
if (player0 != null) { | ||
document.getElementById("name-0").innerHTML =player0; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not properly indented. |
||
var player1 = prompt("Please enter your name", "Player 2"); | ||
if (player1 != null) { | ||
document.getElementById("name-1").innerHTML =player1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not properly indented too. |
||
} | ||
</script> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not how variables should declare.